Skip to content

Instantly share code, notes, and snippets.

@alonsosilvaallende
Created July 11, 2022 11:20
Show Gist options
  • Save alonsosilvaallende/fb3203ae468d109ae207b301fcc84609 to your computer and use it in GitHub Desktop.
Save alonsosilvaallende/fb3203ae468d109ae207b301fcc84609 to your computer and use it in GitHub Desktop.
Untitled.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-07-11T11:18:44.754760Z",
"end_time": "2022-07-11T11:18:53.812556Z"
},
"trusted": true
},
"cell_type": "code",
"source": "import numpy as np\nimport pandas as pd",
"execution_count": 2,
"outputs": []
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-07-11T11:18:54.590882Z",
"end_time": "2022-07-11T11:18:54.687139Z"
},
"trusted": true
},
"cell_type": "code",
"source": "MaxD=3\nnbetat=0\nD1=np.arange(0,MaxD+1,1)\nD2=np.arange(0,MaxD+1,1)\nCorrespEtat = pd.DataFrame()\nfor d1 in D1:\n for d2 in D2:\n nbetat=nbetat+1\n CorrespEtat.loc[d1+1,d2+1]=nbetat\nprint(CorrespEtat) ",
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"text": " 1 2 3 4\n1 1.0 2.0 3.0 4.0\n2 5.0 6.0 7.0 8.0\n3 9.0 10.0 11.0 12.0\n4 13.0 14.0 15.0 16.0\n",
"name": "stdout"
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-07-11T11:19:20.886103Z",
"end_time": "2022-07-11T11:19:20.920978Z"
},
"trusted": true
},
"cell_type": "code",
"source": "# Mai visto. Non sabbebo che si podeva fare cosi\nprint(CorrespEtat[1][2])",
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"text": "5.0\n",
"name": "stdout"
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-07-11T11:19:51.699389Z",
"end_time": "2022-07-11T11:19:51.762895Z"
},
"trusted": true
},
"cell_type": "code",
"source": "CorrespEtat.loc[1,2]",
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 5,
"data": {
"text/plain": "2.0"
},
"metadata": {}
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-07-11T11:20:12.854379Z",
"end_time": "2022-07-11T11:20:12.871265Z"
},
"trusted": true
},
"cell_type": "code",
"source": "CorrespEtat.loc[2,1]",
"execution_count": 6,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 6,
"data": {
"text/plain": "5.0"
},
"metadata": {}
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2022-07-11T11:20:30.723617Z",
"end_time": "2022-07-11T11:20:30.767501Z"
},
"trusted": true
},
"cell_type": "code",
"source": "CorrespEtat.loc[4,2]",
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 7,
"data": {
"text/plain": "14.0"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3 (ipykernel)",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.10.4",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"gist": {
"id": "",
"data": {
"description": "Untitled.ipynb",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment