DSA_SS24/notebooks/demographic_plots.ipynb

349 lines
178 KiB
Plaintext
Raw Normal View History

2024-05-08 17:45:29 +02:00
{
"cells": [
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Demographic Plots\n",
"This Notebook is used to read the data from the pickle files and to create a dataframe with the demographic data.\n",
"With this data we can create a plots to show the distribution of the demographic data."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
2024-06-02 16:27:39 +02:00
"execution_count": 7,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import seaborn as sns\n",
"import matplotlib.pyplot as plt\n",
2024-06-02 16:27:39 +02:00
"import pickle\n",
"from scipy.stats import chi2_contingency"
2024-05-15 20:20:01 +02:00
]
},
{
"cell_type": "code",
2024-06-02 16:27:39 +02:00
"execution_count": 3,
2024-05-15 20:20:01 +02:00
"metadata": {},
"outputs": [],
"source": [
"# Set path to data\n",
"path = \"C:/Studium/dsa/data\"\n",
"#path = \"C:/Users/Nils/Documents/HS-Mannheim/0000_MASTER/DSA/EKG_Prog/data\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Load Data"
2024-05-08 17:45:29 +02:00
]
},
{
"cell_type": "code",
2024-06-02 16:27:39 +02:00
"execution_count": 4,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading SB\n",
2024-05-29 09:25:12 +02:00
"Length of SB: 50\n",
2024-05-08 17:45:29 +02:00
"Reading AFIB\n",
2024-05-29 09:25:12 +02:00
"Length of AFIB: 27\n",
2024-05-08 17:45:29 +02:00
"Reading GSVT\n",
2024-05-29 09:25:12 +02:00
"Length of GSVT: 0\n",
2024-05-08 17:45:29 +02:00
"Reading SR\n",
2024-05-29 09:25:12 +02:00
"Length of SR: 13\n"
2024-05-08 17:45:29 +02:00
]
}
],
"source": [
"\n",
2024-05-29 09:25:12 +02:00
"#path = \"C:/Studium/dsa/data\"\n",
2024-05-08 17:45:29 +02:00
"#path = \"C:/Users/Nils/Documents/HS-Mannheim/0000_MASTER/DSA/EKG_Prog/data\"\n",
2024-05-29 09:25:12 +02:00
"path = \"C:/Users/klara/projects/DSA/data\"\n",
2024-05-08 17:45:29 +02:00
"\n",
"categories_dict = {\n",
"'SB': [426177001],\n",
"'AFIB': [164889003, 164890007],\n",
"'GSVT': [426761007, 713422000, 233896004, 233897008, 713422000],\n",
"'SR': [426783006, 427393009]\n",
"}\n",
"\n",
"data = {}\n",
"for cat_name in categories_dict.keys():\n",
" print(f\"Reading {cat_name}\")\n",
" with open(f'{path}/{cat_name}.pkl', 'rb') as f:\n",
" records = pickle.load(f)\n",
" data[cat_name] = records\n",
" print(f\"Length of {cat_name}: {len(records)}\")\n",
"\n",
"data_demographic = {'age':[], 'diag':[], 'gender':[]}\n",
"for cat_name, records in data.items():\n",
" for record in records:\n",
" age = record.comments[0].split(' ')[1]\n",
" sex = record.comments[1].split(' ')[1]\n",
" if age == 'NaN' or sex == 'NaN':\n",
" continue\n",
" # cut Age: from alter string \n",
" data_demographic['age'].append(int(age))\n",
" data_demographic['diag'].append(cat_name)\n",
" data_demographic['gender'].append(sex)\n",
"\n",
"df_dgc = pd.DataFrame(data_demographic)\n",
"\n",
"# Change from group to category\n",
2024-05-12 13:31:54 +02:00
"age_categories = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]\n",
2024-05-08 17:45:29 +02:00
"df_dgc['age_group'] = pd.cut(df_dgc['age'], bins=age_categories)"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot Data"
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
2024-06-02 16:27:39 +02:00
"execution_count": 5,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-06-02 16:27:39 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmUAAAHJCAYAAADEuU4vAAAAOXRFWHRT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IODg+jRo4fo3LmzsLKyEgBEkyZNityfS1PSOSn07L2xpPLy3DOFEGL//v3K665GjRoiJCRE+Pv7CyMjI9GzZ88S7+2lKfzbl/Q+nvXOO+8Uey+R6nus0O3bt5XfZba2tqJHjx6ie/fuwsbGRnh6eoru3bsXe70WvpcPP/xQWFpaCldXVxEcHCz8/f2V3xPdu3cvUp8697qkpCTl+6hevboICgoSvXv3Fm+99ZawtbUVVlZWRepRJ0dQ9z29iNpJWWBgoDA0NBQAxNdff13qPosXLxYAhJ2dnTh+/LiyvKCgQHnRWFtbF7lBFNZlYGAgNmzYUPwb+P+bt6WlpYiLiyuyPikpSVSuXFnIZDLx/fffi/z8fOW6e/fuiXbt2gkAYurUqSr7lXQxp6eniw0bNojs7GyV8pycHBEZGSkAiM6dOxeJ40U312ff7/Mf3N69ewsAolmzZuLevXvK8kePHolOnToJAKJFixYq+xTeYApvMufPn1euy8vLEwMHDlRebM8q/EKaPn16kfgyMzPF3r17VcoKb4AARNeuXcXjx4+V644ePSoMDQ2VXzjDhg0Tubm5yvXr169X/u2e3U8IIQ4dOiROnTpVJIZbt26Jhg0bCgBizZo1RdaXlEwVF2/79u3Fw4cPi92upOOkpqYKNzc3AUAsXrxYCPH0mij8wn7RZ+FZDx8+FGZmZkIul4ubN28WWX/ixAkBQDg4OKict5f
2024-05-08 17:45:29 +02:00
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Correlation matrix\n",
"corr_matrix_age_diag= pd.crosstab(df_dgc['age_group'], df_dgc['diag'])\n",
"\n",
"# Plot the correlation matrix\n",
"sns.heatmap(corr_matrix_age_diag, annot=True, cmap='coolwarm', fmt='d')\n",
2024-05-15 20:20:01 +02:00
"plt.title('Korrelationsmatrix von Altersgruppen und Diagnosen', fontsize=16)\n",
2024-05-08 17:45:29 +02:00
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Altersgruppe')\n",
"plt.show()"
]
},
2024-06-02 16:27:39 +02:00
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Chi-Square Statistic: 38.266574797751275\n",
"P-value: 0.0004730210823940083\n",
"Chi-Square Statistic for SB in 60-70 vs others: 1.4858035714285718\n",
"P-value for SB in 60-70 vs others: 0.22286870264719977\n"
]
}
],
"source": [
"\n",
"# Chi-square test\n",
"chi2, p, _, _ = chi2_contingency(corr_matrix_age_diag)\n",
"\n",
"# Difference between observed and expected frequencies\n",
"print(f\"Chi-Square Statistic: {chi2}\")\n",
"print(f\"P-value: {p}\")\n",
"\n",
"# Check if SB (Sinusbradykardie) has a significantly higher frequency in the 60-70 age group\n",
"sb_60_70 = corr_matrix_age_diag.loc[pd.Interval(60, 70, closed='right'), 'SB']\n",
"sb_other = corr_matrix_age_diag.drop(pd.Interval(60, 70, closed='right')).sum()['SB']\n",
"total_60_70 = corr_matrix_age_diag.loc[pd.Interval(60, 70, closed='right')].sum()\n",
"total_other = corr_matrix_age_diag.drop(pd.Interval(60, 70, closed='right')).sum().sum()\n",
"\n",
"# Frequency table for the specific Chi-Square test\n",
"observed = [[sb_60_70, total_60_70 - sb_60_70], [sb_other, total_other - sb_other]]\n",
"chi2_sb, p_sb = chi2_contingency(observed)[:2]\n",
"\n",
"\n",
"print(f\"Chi-Square Statistic for SB in 60-70 vs others: {chi2_sb}\")\n",
"print(f\"P-value for SB in 60-70 vs others: {p_sb}\")"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Correlation matrix of age groups and diagnoses.This matrix describes the four diagnosis groupings on the horizontal axis and the age groupings in decades steps on the vertical axis. The color scale blue (low) to red (high) describes the correlation of the two categorization types."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
2024-06-02 16:27:39 +02:00
"execution_count": 7,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-06-02 16:27:39 +02:00
"image/png": "iVBORw0K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AQVlZWol27dmLgwIGiffv2okKFCnnO09z3f/PNN4WTk5Pw8fER/fr1EyEhIfJ3smfPngbrvPXWWyIwMFAAEDVq1DD47syfPz//D+4J7dq1EwDE7t27jc7P75qaWz58+HDh5eUlKlasKHr37i3CwsKEs7OzACCaN2+e5xothBBvvPGGACA0Go1o27atGDBggKhbt67QaDTizTffFADyfK7PkvvZ5rcfuVJSUoQkSQKAWLNmjcG8/K7lz3tdy7VmzRr5vGnQoIEYOHCgaNu2rdBoNGLq1Kn5Xq9yy2fMmCEkSRKBgYGif//+olGjRgKAkCTJ6Hc3Pj5e3ocKFSqI8PBw0b17d+Ho6CgAiKZNm4q7d+8arLNy5UohSZKQJEkEBASI/v37i+7du4umTZsKCwsL8eabb+Z5n7feekv+/Fq0aCH69u0rAgIChCRJwsLCQixfvtxk+/QsL5wMde3aVVhaWgoA4pNPPilwnSVLlggAws3NTZw6dUouz8nJkb8ILi4u4tatW0bfy8LCQmzevNn4Dvz/A+Pk5CQOHz6cZ/6NGzdE+fLlhSRJYvHixSI7O1ued/v2bREcHGz0IpTfF/f+/fti8+bNQqfTGZQ/fvxYREZGCgAiLCwsTxwFXSCf3t+nv0D9+/cXAERAQIC4ffu2XP7gwQPRpUsXAUC0atXKYJ3cZCg3IYqLi5PnZWVlieHDh8uJ4JOGDRsmAIi5c+fmie/hw4di7969BmW5yQUA0a1bN5Geni7PO3HihLC
2024-05-08 17:45:29 +02:00
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# cut out sex 'unknown' (because only one occurence)\n",
"df_dgc_bineary = df_dgc[df_dgc['gender'] != 'Unknown']\n",
"# Correlation matrix\n",
"corr_matrix_sex_diag = pd.crosstab(df_dgc_bineary['gender'], df_dgc_bineary['diag'])\n",
"\n",
"# Plot the correlation matrix\n",
"sns.heatmap(corr_matrix_sex_diag, annot=True, cmap='coolwarm', fmt='d')\n",
2024-05-15 20:20:01 +02:00
"plt.title('Korrelationsmatrix von Geschlecht und Diagnosen', fontsize=16)\n",
2024-05-08 17:45:29 +02:00
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Geschlecht')\n",
"plt.show()"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Correlation matrix of genders and diagnoses. This matrix describes the four diagnosis groupings on the horizontal axis and the gender in decades steps on the vertical axis. The color scale blue (low) to red (high) describes the correlation of the two categorization types."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
2024-06-02 16:27:39 +02:00
"execution_count": 8,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-06-02 16:27:39 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAHbCAYAAACtCWxXAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAABsl0lEQVR4nO3deXxM1/8/8NdkmySVxZpFNkskiNhFQouKhCpiaygVoVqK1ieo6sdabaOqSlulJehi/3xQVJGmwkdFEdS+a0MlQSwhYYzM+f3hl/s1ZrLPevN6Ph7zYM499973uXfuyXvuckYhhBAgIiIiIqtmY+4AiIiIiKjimNQRERERyQCTOiIiIiIZYFJHREREJANM6oiIiIhkgEkdERERkQwwqSMiIiKSASZ1RERERDLApI6IiIhIBpjUkV4BAQFQKBRYsWJFsfU6duwIhUKBGTNmaJWnpqZCoVCgY8eORouRrNfQoUNL9fkyl3nz5kGhUEChUODLL78sti4/69ZlxYoVUCgUGDp0qFb5X3/9BYVCgYCAALPERWQITOrIohXVARMZU1JSkvT/ZcuWlXs5hYkhlV3hF8bU1FRzh0JkNezMHQDJU5s2bXD69Gk4OzubOxSiMtm/fz9OnToFd3d3qNVqHD16FIcPH0aLFi3MHRoZQO/evdG2bVu4ubmZOxQig2NSR0bh7OyM4OBgc4dBVGaFZ+k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iopb7rMJ90qJFCzRq1EhnerNmzfTuqyNHjuDatWuoV68eWrZ
2024-05-08 17:45:29 +02:00
"text/plain": [
"<Figure size 640x480 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# 4 subplots for each diagnosis a histrgramm for the age\n",
"fig, axs = plt.subplots(2, 2)\n",
2024-05-15 20:20:01 +02:00
"fig.suptitle('Histogramm der Altersverteilung', fontsize=16)\n",
2024-05-08 17:45:29 +02:00
"for i, cat_name in enumerate(categories_dict.keys()):\n",
" ax = axs[i // 2, i % 2]\n",
" df_dgc[df_dgc['diag'] == cat_name]['age'].hist(ax=ax)\n",
" ax.set_title(cat_name)\n",
" ax.set_xlabel('Alter')\n",
" ax.set_ylabel('Anzahl')\n",
2024-05-12 13:31:54 +02:00
" # add some space between the subplots\n",
"plt.tight_layout()\n",
2024-05-08 17:45:29 +02:00
"plt.show()"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Histogram of the age distribution. Breakdown of grouped diagnoses by age group and absolute incidence of diagnoses."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
2024-06-02 16:27:39 +02:00
"execution_count": 9,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-06-02 16:27:39 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjIAAAHHCAYAAACle7JuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAABImElEQVR4nO3deXgNd///8deRXSIJEZIQ+77edmpfk1hqSW23VuzlRkuq2vSunSpd0N5F7xZp3VRbtZWi1qqttVNaJQ3R1k4WWyLJ/P7wc76OBAmJk+H5uK65LjPzmc+8zzkjeWXmM3MshmEYAgAAMKFc9i4AAADgYRFkAACAaRFkAACAaRFkAACAaRFkAACAaRFkAACA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x9W/fr1VahQIesx/tVXX6lDhw765ptv1LFjR+tnOHnyZPXr10+1a9dWfHy8du/erb1796ply5aSpIMHD6phw4ZycnLSgAEDVKxYMUVFRenbb7/VpEmTbPbbpUsXFS9eXJMnT9bevXv16aefqkCBApoyZco9a7127ZoaN26sv/76Sy+++KKKFCmi7du3KyIiQqdPn9b06dOtbfv27avIyEiFhISoX79+Sk5O1o8//qidO3fanNl80GfcqVMn/f777/riiy80bdo06+fk6+ub4fcYWcwAHsHu3bsNSca6desMwzCM1NRUo3DhwsbLL79s0y46OtqQZPj4+BiXLl2yLl++fLkhyfj222/T7T81NdVo27at4eHhYRw+fNi6/Nq1a2navvjii0bu3LmNGzduWJc1btzYkGR8/vnn1mWJiYmGn5+fERoamqa+efPm3ff1Dhs2zJBk/PTTT9Zl586dM7y8vAxJRnR0tGEYhpGQkGB4e3sb/fv3t9n+zJkzhpeXl83ysLAwQ5Lx+uuv33fft82bN8+QZOzateuebby8vIxq1apZ58eMGWPc/d89vfcwKCjIKFGihE29jo6ORocOHWzajR071pBkhIWFpamrRYsWRmpqqnX58OHDDQcHByM2NtYwjFvvl7Ozs9GqVSsjJSXF2u4///mPIcmYO3euYRiGsW/fPkOS8fXXX9/zdZ44ccJwcHAwJk2aZLP80KFDhqOjo83yjB4L9yLJcHZ2No4fP25dduDAAUOS8eGHH1qXpfe+7tixI82+R48ebUgylixZkqb97fdv06ZNhiSjfPnyRmJionX9jBkzDEnGoUOH7llvXFycISnNZ2cYhnH58mXj/Pnz1unOmps3b25UrlzZ5v9Ramqq8cwzzxilS5e2LqtatarRpk2be+7fMAyjUaNGRp48eYyTJ0+m+/oM4/+OzT59+ti06dixo+Hj42OzrGjRojbH3IQJEwx3d3fj999/t2n3+uuvGw4ODkZMTIxhGIaxceNGQ5Lx0ksvpanxzloy+hm/8847Nv/fYV9cWsIjWbBggQoWLKimTZtKunX6vWvXrlq0aFG6l3m6du2qvHnzWucbNmwoSfrjjz/S7X/ChAlauXKlIiMjVaFCBevyO8+AJCQk6MKFC2rYsKGuXbum3377zaYPDw8PPf/889Z5Z2dn1a5d+577vJ/vvvtOdevWVe3ata3LfH1901wKWrdunWJjY9W9e3dduHDBOjk4OKhOnTratGlTmr4HDRqU6XruxcPD44F3L935HsbFxenChQtq3Lix/vjjD+ulmw0bNig5OVn/+te/bLa9Pbg4PQMGDLC5jNWwYUOlpKRYB5SuX79eSUlJGjZsmM3YjP79+8vT01OrVq2SJOsZl7Vr197zEsOSJUuUmpqqLl262LzPfn5+Kl26dJr3+VGPhRYtWqhkyZLW+SpVqsjT09Nm+zvf15s3b+rixYsqVaqUvL29tXfvXuu6b775RlW
2024-05-08 17:45:29 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# a barplot for each category with the age grpuoped besides each other\n",
"fig, ax = plt.subplots()\n",
"sns.countplot(data=df_dgc_bineary, x='diag', hue='gender', ax=ax)\n",
"plt.title('Anzahl der Diagnosen nach Geschlecht')\n",
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Anzahl')\n",
"plt.show()"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Barplot to visualize the distribution of diagnoses by gender. Where blue is female and orange is male."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
2024-05-12 13:31:54 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAHHCAYAAABeLEexAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABhoUlEQVR4nO3dd1gU1/s28HtpS5PeRIooRsUuRkGiWFA0xBJJNMaCPRrUqIn6JVEsiTGxGxtJRFFjT2wRu4gVGxG7WAJqFNCggJV63j/y7vxcFxRkYdW5P9e118WceW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n5S0ebPbsPMzMz8e+//8Lf3x9///239JXU3r17kZeXh88//1xtWdVF3IUZNGiQ2tdzzZo1Q35+Pq5fvw4A2LNnD3JycjBixAjo6f3f29LAgQNhYWGB6OhoAJDOAO3cubPIa042bNiAgoICdO3aVW0/Ozk5oVq1ahr7ubSvhYCAAFStWlWarlu3LiwsLNSWf3a/5ubmIj09HZ6enrCyssJff/0lzfvjjz9Qr149fPjhhxrbef7rzb59+8LIyEiaftlx86ySHqPFUdL9rlQq0bdvX7U21RmkrVu3Ijc3t9Dt7NixA4aGhmpnOvX09NTOYD5PG8dR7969UaFCBWn6o48+QsWKFbFt2za1OAMDA3z22WfStJGRET777DPcuXMH8fHxAID169ejZs2aqFGjhtq+atWqFQBo7KvivMao9FgQkVbl5+djzZo1aNmyJZKSknD16lVcvXoVTZo0QVpaGvb
2024-05-08 17:45:29 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# barplot how many diagnosis are in each age group\n",
"fig, ax = plt.subplots()\n",
"sns.countplot(data=df_dgc, x='age_group', hue='diag', ax=ax)\n",
"plt.title('Anzahl der Diagnosen nach Altersgruppen')\n",
"plt.xlabel('Altersgruppe')\n",
"plt.ylabel('Anzahl')\n",
"plt.show()"
]
2024-05-15 20:20:01 +02:00
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Barplot to show the distribution of diagnoses based on the age groupings. The difference in the incidence of the various diseases can be clearly seen here."
]
2024-05-08 17:45:29 +02:00
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2024-05-29 09:25:12 +02:00
"version": "3.11.9"
2024-05-08 17:45:29 +02:00
}
},
"nbformat": 4,
"nbformat_minor": 2
}