DSA_SS24/notebooks/demographic_plots.ipynb

239 lines
198 KiB
Plaintext
Raw Normal View History

2024-05-08 17:45:29 +02:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import seaborn as sns\n",
"import matplotlib.pyplot as plt\n",
"import pickle\n",
"import wfdb"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading SB\n",
"Length of SB: 16559\n",
"Reading AFIB\n",
"Length of AFIB: 9839\n",
"Reading GSVT\n",
"Length of GSVT: 948\n",
"Reading SR\n",
"Length of SR: 9720\n"
]
}
],
"source": [
"\n",
"path = \"C:/Studium/dsa/data\"\n",
"#path = \"C:/Users/Nils/Documents/HS-Mannheim/0000_MASTER/DSA/EKG_Prog/data\"\n",
"\n",
"categories_dict = {\n",
"'SB': [426177001],\n",
"'AFIB': [164889003, 164890007],\n",
"'GSVT': [426761007, 713422000, 233896004, 233897008, 713422000],\n",
"'SR': [426783006, 427393009]\n",
"}\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",
"age_categories = [0, 20, 40, 60, 80, 100]\n",
"df_dgc['age_group'] = pd.cut(df_dgc['age'], bins=age_categories)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiQAAAHHCAYAAACPy0PBAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAACkhUlEQVR4nOzdd1zU9R/A8dcdcMeSpUxFwS3O3KjlQlEcWWppljjKkZorM8tMzW1uc6SmZaVZjsy985fiotwjB4oLEJUhG+77+wM5PcHg7PCQ3s/H4/vQ+34/38+9vwd39+azvipFURSEEEIIIcxIbe4AhBBCCCEkIRFCCCGE2UlCIoQQQgizk4RECCGEEGYnCYkQQgghzE4SEiGEEEKYnSQkQgghhDA7SUiEEEIIYXaSkAghhBDC7CQhMZKPjw89evQwaZ09evTAx8fHpHUWRvnx2r+oVCoVY8eONXcYooDbt28fKpWKffv2mbzusWPHolKpTF6v+O8ye0KyYsUKVCoVx44dM9gfGxtL3bp1sba2Ztu2bWaKznRu3brF2LFjOX78uLlDMbuzZ88yduxYrl69au5QCqQFCxagUqmoV69ens85ePAgY8eOJSYmJv8CE4VW1udw1mZtbY2XlxeBgYHMnTuX+Ph4c4co/gPMnpDkJC4ujpYtW3Ly5EnWr19Pq1atzB3Sv3br1i3GjRuXY0KyZMkSLly48PyDMpOzZ88ybtw4oxOSCxcusGTJkvwJqgD54Ycf8PHx4ciRI1y6dClP5xw8eJBx48ZJQiL+lfHjx7Ny5UoWLlzIoEGDABgyZAhVq1bl5MmTBmVHjx5NUlKSOcIUhVSBS0ji4+MJDAzk+PHjrF27ltatW//rOhMSEp56LDEx8V/X/29ZWVmh1WrNHUaBpCiK/kNPq9ViZWVl5ojyV1hYGAcPHmTmzJm4urryww8/mDWe5/X++Kf3qHh+Wrduzdtvv03Pnj0ZNWoU27dvZ9euXURFRdG+fXuD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2VgYPHqwsWLBAadasmQIoW7Zs0ZdLTExUypcvr1hbWysfffSRMnv2bKVWrVpKtWrVstX5TzEdPXo0x+PXr19XAKVTp076fZ9//rny5FdInTp1lB49eiizZs1S5s2bp7Rs2VIBlPnz5xuU++ijjxRAadeunTJ//nzlvffeU0qUKKEUK1bM4OefFddLL72kNGvWTJk3b54yfPhwxcLCQnnjjTcM6syKJyAgQJk3b54ycOBAxcLCQqlTp46SmpqqKIqipKSkKL6+voqXl5cyYcIEZenSpcq4ceOUOnXqKFevXtXXZcx7Ji8/H5E3BSYhKVWqlGJlZaVs2LAhx3IdOnRQNBqN/ktcURTl1q1bSpEiRZRXXnklW32NGjVS0tPTDepo3LixAiiLFi0y2L9y5UpFrVYr//vf/wz2L1q0SAGUAwcO6Pc9+YGZnJysZGRkGJwXFhamaLVaZfz48fp9R48ezfbBnOXJhGTDhg0KoEyYMMGgXKdOnRSVSqVcunRJvw9QNBqNwb4TJ04ogDJv3jz9PkdHR2XAgAHZnvtxWa/Pjz/+qN93/vx5BVDUarVB4rd9+/Zs1/P4l0CWkJAQBdB/4ShKZuLytA/JUqVKKYCybdu2HI89+WW1ePFiBVC+//575dChQ4qFhUW2pC0nWeedOnXKYL+fn5/SrFkz/eMhQ4YogMHvRnx8vOLr66v4+Pjof/ZZXyaVKlVSUlJS9GXnzJmT4/Pk5NixYwqg7Ny5U1GUzMS0RIkSyuDBg7OVfTwhURRFmT59eo5fclevXlUsLCyUiRMnGuw/deqUYmlpabD/ae+P9evX/+OXlaIoytq1axVAmT17tn5fRka
"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",
"plt.title('Korrelationsmatrix von Altersgruppen und Diagnosen')\n",
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Altersgruppe')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiwAAAHHCAYAAACcHAM1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABwNUlEQVR4nO3dd1QUVxsG8GdpS69SBQEFURQ16qexd7Fr1ERjF0tULKix9xZji12xl8QSe4uxt0SJvWBvKDZAKSKI1Pv9QZi4ggrsrrvA8ztnzmHv3Jl5Z7a93DIrE0IIEBEREWkxHU0HQERERPQ5TFiIiIhI6zFhISIiIq3HhIWIiIi0HhMWIiIi0npMWIiIiEjrMWEhIiIirceEhYiIiLQeExYiIiLSekxY1MzNzQ3dunVT6T67desGNzc3le4zP1LHtafsmzhxImQyGV69evXZuup+rmQyGfr376+2/X8JtWvXRu3atdWyb5lMhokTJ6pl30SqkucSlrVr10Imk+HChQsK5a9fv0alSpVgaGiIAwcOaCg61Xn+/DkmTpyIK1euaDoUjbt58yYmTpyIR48eaToUrRMSEoL+/fujePHiMDY2hrGxMby9veHv749r165pOrw858yZM5g4cSJiYmI0HUquubm5QSaTQSaTQUdHB5aWlvDx8UHv3r1x9uxZTYdHlGt6mg5AFWJjY9GwYUNcu3YNO3fuRKNGjTQdktKeP3+OSZMmwc3NDeXKlVNYt2LFCqSlpWkmMA24efMmJk2ahNq1a+eoZenOnTvQ0clzOXm27du3D+3atYOenh46duyIsmXLQkdHB7dv38aOHTuwdOlShISEwNXVVdOh5hlnzpzBpEmT0K1bN1haWmo6nFwrV64chg4dCgB48+YNbt26ha1bt2LFihUYPHgwfvnlF4X6CQkJ0NPLF18HlI/l+Vfomzdv4OvriytXrmDHjh1o3Lix0vuMj4+HiYlJluvevn0LY2NjpY+hDH19fY0eX5s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iCvv8VExNmzb96PoePXoIAOL69esK12fChAnS4+y8N4UQ4unTp8La2lrY2NiISZMmidmzZ4sSJUqIsmXLCgAiJCREIS4vLy9hb28vRo8eLRYtWiTKly8vZDKZQizZfQ8tX75cABBt27YVy5YtE/Pnzxc9evQQAwcOVNiXs7OzcHFxEZMnTxZLly4VLVq0kJ7j3Dw/pDl5NmFxdXUV+vr6YteuXVnWa9WqlTAwMJC+5IUQ4vnz58LMzEzUrFkz0/6qV68uUlJSFPZRq1YtAUAEBgYqlP/6669CR0dH/PXXXwrlgYGBAoA4ffq0VPbhB9q7d+9EamqqwnYhISFCLpeLyZMnS2Xnz58XAMSaNWsynduHCcuuXbsEADF16lSFem3bthUymUzcv39fKgMgDAwMFMquXr0qACh8wFtYWAh/f/9Mx35fxvXZuHGjVHb79m0BQOjo6CgkhgcPHsx0Pm/fvs20z6CgIAFArF+/XirbunWrACAlIu9zdXUVAMSBAweyXPfhl8myZcsEAPHbb7+Jf/75R+jq6mZK6rKSsV1wcLBCube3t6hbt670OCAgQABQeG28efNGuLu7Czc3N+m5z/iALFmypEhMTJTqzp8/P8vjvO/169cCgGjVqlWmddHR0eLly5fS8v41rlevnvDx8RHv3r2TytLS0kTVqlWFp6enVFa2bNlPfuEJIUTNmjWFmZmZePz4sUJ5Wlqa9HdGwuLn56dQ55tvvhE2NjYKZR8+V1OmTBEmJibi7t27CvVGjhwpdHV1RWhoqBBCiGPHjgkACl9SWcWS3df9rFmzMn3RfkpOE5bPPd9JSUnCzs5OlCtXTqFexpezKhKWuXPnCgAK/+h9mLBk9705YMA
"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",
"plt.title('Korrelationsmatrix von Geschlecht und Diagnosen')\n",
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Geschlecht')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAHgCAYAAABEhXI/AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAByEUlEQVR4nO3deVxUZfs/8M8wMIOIgKiAKCApiYpb4IKaK4JG7j5puWuZhhpqbk+puKXhnrmUmvQ84VpqpaZMuJCJG4ULlkvi48ZSKaAgw8jcvz/8cb6OLALOMDPM5/16zUvnPvc55zpwuLg459z3yIQQAkREREQWzMrYARAREREZGwsiIiIisngsiIiIiMjisSAiIiIii8eCiIiIiCweCyIiIiKyeCyIiIiIyOKxICIiIiKLx4KIiIiILB4LIrJo9erVw8iRI40dBj2lc+fO6Ny5s7HDKCQqKgoymQw3btwwdihma+TIkahXr55Om0wmQ0REhFHiIXoaCyKqNAp+YZ09e7bI5Z07d4afn98L7+fAgQNM4JVQ69atIZPJsH79+lKvs27dOkRFRRkuKBNy4sQJREREICMjw9ihEBkECyKyaJcvX8bGjRvLtM6BAwcwb948A0VExnD16lWcOXMG9erVQ3R0dKnXs7SCaN68eS9UEG3cuBGXL1/WX1BEesSCiCyaUqmEjY2NscMok+zsbGOHYDa0Wi1yc3Of2+/rr7+Gi4sLli9fjhMnThj1ttjjx4+Rl5dntP0/S5/nm42NDZRKpd62R6RPLIjIoj37DJFGo8G8efPg4+MDW1tb1KhRAx06dIBKpQLw5BmItWvXAnjy7EPBq0B2djamTp0KDw8PKJVKNGzYEMuWLYMQQme/jx49wqRJk1CzZk1Uq1YNvXv3xp07dwo9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rVroVKpCr2aNWv23HWdnJyQlJSEq1evlnm/Bw4cgFwux6RJk3Tap06dCiEEfvzxRwCQLue/9957Ov0mTpxY7LbHjRtXqK1KlSrS/3Nzc/H333+jbdu2AIBff/21UP+3335b+r9cLkdAQACEEBgzZozU7uTkhIYNG+L69euF1h8+fLjO81Zt2rSBEAKjR4/W6demTRvcunULjx8/LvZ4zp49i/T0dIwbNw4KhUJqHzlyJBwdHXX67tq1C40aNYKvry/+/vtv6dW1a1cAwJEjR3T6d+rUCY0bNy523097/PgxduzYgUGDBklX1Lp27QoXF5cyPVz9rF27duHVV19F9erVdWIOCgpCfn4+4uLidPoPGDCg0NUKJycn3L59G2fOnCl2P4MGDUJ6ejqOHj0qtX3zzTfQarUYNGgQAODevXs4fPgw3njjDTx48ECK5Z9//kFISAiuXr2KO3fu6Gz3nXfegVwuL9Wx7t69G1qtFm+88YbOsbq5ucHHx6fQ90ffgoKCUL9+fel9s2bN4ODgIJ3D+fn5+Omnn9C3b1+4u7tL/Ro0aICePXsaNDYyL7xlRpVO69atERAQUKi94JdTSebPn48+ffrg5Zdfhp+fH3r06IFhw4aVqpj63//+B3d3d1SrVk2nvVGjRtLygn+trKzg7e2t069BgwbFbvvZvsCTX3Tz5s3D9u3bkZ6errMsMzOzUH9PT0+d946OjrC1tZVufzzd/uxzSMWtD0Dn9lZBu1arRWZmpnTL4lkFXwsfHx+ddhsbG7z00ks6bVevXsXvv/9e7O2NZ4+9qK9VcWJiYvDXX3+hdevWuHbtmtTepUsXbNu2DZ988gmsrMr+d+PVq1dx/vz5F4p5xowZ+Omnn9C6dWs0aNAAwcHBeOutt9C+fXupT48ePeDo6IgdO3agW7duAJ7cLmvRogVefvllAMC1a9cghMD
"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",
"fig.suptitle('Histogramm der Altersverteilung')\n",
"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",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAk0AAAHHCAYAAACiOWx7AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABSSUlEQVR4nO3dd1QU1/8+8GfpTapURcQuigVUxF6IoGCPLdi7ASNi+Uii2GPEbqISEwVjMJoYeyegMSo2bMSCiigmCsRCs4DA/f3hj/m6gjoouIs+r3P2HPfeOzPv2VngceburEIIIUBEREREr6Wh6gKIiIiIygKGJiIiIiIZGJqIiIiIZGBoIiIiIpKBoYmIiIhIBoYmIiIiIhkYmoiIiIhkYGgiIiIikoGhiYiIiEgGhiaiEtCmTRvUrVv3jeNu3rwJhUKB8PDwt9pOeHg4FAoFbt68+VbLl7YZM2ZAoVCougwqpkOHDkGhUGDz5s2qLqXUFLw3792798axlStXxuDBg0utFoVCAX9//1JbP5UehiYqU1auXAmFQgE3NzdVl/LBKwhoBQ89PT3Y2dnB09MTy5cvR2ZmpqpLJDWTmJgIf39/1KhRAwYGBjAwMICTkxP8/Pxw4cIFVZdX5hw7dgwzZsxAWlqaqkuh/4+hicqUiIgIVK5cGSdPnsT169dVXc5HYdasWVi/fj1WrVqFsWPHAgACAgLg7Oxc6A/h1KlT8eTJE1WUSSq2a9cu1K1bF+vXr4eHhweWLFmCZcuWoWPHjtizZw8aNGiAW7duqbrMMuXYsWOYOXMmQ5Ma0VJ1AURyJSYm4tixY9iyZQtGjRqFiIgITJ8+XdVllWmPHj2CoaHha8d07N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a/ddoGwsDABQJw6deqVY0xMTETDhg2l59OnTxcv/1op6jX09PQUVapUUapXS0tLdOvWTWncjBkzBAAxaNCgQnV5eHiI/Px8qX38+PFCU1NTpKWlCSGev146OjqiQ4cOIi8vTxr33XffCQBi7dq1Qgghzp49KwCI33777ZX7efPmTaGpqSnmzp2r1B4XFye0tLSU2uW+F14FgNDR0RHXr1+X2s6fPy8AiG+//VZqK+p1jYmJKbTt4OBgAUBs2bKl0PiC1+/gwYMCgKhdu7bIzs6W+pctWyYAiLi4uFfWm56eLgAUOnZCCPHw4UPx33//SY8Xa27fvr1wdnZW+jnKz88XzZo1E9WrV5fa6tevL7y9vV+5fSGEaNWqlShXrpy4detWkfsnxP+9N4cOHao0pnv37sLCwkKpzcHBQek9N3v2bGFoaCiuXr2qNG7KlClCU1NTJCUlCSGEiI6OFgDEF198UajGF2uRe4wXLFig9PNOqsfLc1QmREREwNraGm3btgXw/BJGnz59sHHjxiIvlfXp0wdmZmbS85YtWwIAbty4UeT6Z8+ejV27diE8PBxOTk5S+4tndjIzM3Hv3j20bNkSjx8/xpUrV5TWYWRkhP79+0vPdXR00KRJk1du83X27NmDpk2bokmTJlKbpaVloctpkZGRSEtLQ79+/XDv3j3poampCTc3Nxw8eLDQuseMGVPsel7FyMjojZ+ie/E1TE9Px71799C6dWvcuHFDuvwVFRWF3NxcfP7550rLFkw8L8rIkSOVLgW2bNkSeXl50mTjP/74Azk5OQgICFCaSzNixAgYGxtj9+7dACCdSdq/f/8rL9Ns2bIF+fn56N27t9LrbGNjg+rVqxd6nd/1veDh4YGqVatKz+vVqwdjY2Ol5V98XZ89e4b79++jWrVqMDU1xZkzZ6S+33//HfXr15fO3Lzo5UupQ4YMgY6OjvT8TT83AJCRkQHg+T6/rE2bNrC0tJQeK1asAAA8ePAA0dHR6N2
"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()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAHHCAYAAABeLEexAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABic0lEQVR4nO3dd1QU19sH8O9SdmkuiDQRRBSjYC9RkNhRNGgsJFFjwR4NaNRE/WEM9pioWGIjiQhq7IkaxYoCGhUbEXuwgRgViChgpd73jxzmdQUVcGHB/X7O2XPcO8/cuXNnd3yYuXdWJoQQICIiItJiOppuABEREZGmMSEiIiIirceEiIiIiLQeEyIiIiLSekyIiIiISOsxISIiIiKtx4SIiIiItB4TIiIiItJ6TIiIiIhI6zEhIq3Trl071K9f/41xCQkJkMlkCA0NLdF2QkNDIZPJkJCQUKL1S9v06dMhk8k03QwqpqioKMhkMvz2229lsj2ZTIbp06eXybaINIkJEZWaFStWQCaToWXLlppuyjsvP/nKfxkYGMDW1haenp748ccf8ejRI003kcqhknxHjx8/junTpyMtLa30GkakAUyIqNSsX78eNWrUwKlTp3D9+nVNN0crzJw5E+vWrcPKlSsxZswYAMC4cePQoEEDnD9/XiV26tSpePbsmSaaSeVESb6jx48fx4wZM5gQ0TuHCRGVivj4eBw/fhwLFy6EpaUl1q9fr+kmVXhPnjx5Y0zXrl0xYMAADBkyBP7+/ti/fz8OHjyIlJQUfPTRRyoJkJ6eHgwMDEqzyVSOlbfv6NOnT8tkO0X5HpF2YkJEpWL9+vWoXLkyvLy88PHHHxd6ss0fo7NgwQL8/PPPqFWrFhQKBd5//32cPn1aissfM1HYq0aNGlLc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lcXL9+XSo7d+6cACCWLl0qlRXWr9HR0QW2HRAQIACIbdu2FYjP77/IyEgBQDg7O4vMzExp+ZIlSwQAceHChTe2u6jf0fx9nDZtmvR+/vz5Kp/rfCXp96CgIJXY7du3v/Fz/PvvvwsAYvHixVJZbm6u6NChQ4Hv6+u+Rw4ODiqf1Rfb1rZtW+l9fn9Xq1ZNZGRkSOVbtmwRAMSSJUsK7FdgYKBUlpmZKRo3biysrKxEVlaWEEKIdevWCR0dHfHnn3+qbDsoKEgAEMeOHZPKivoZo7fHW2akduvXr4e1tTXat28P4L9Lvn369MGmTZsKvX3Vp08fVK5cWXrfunVrAMDNmzcLrX/WrFkICwtDaGgoXFxcpPIX/0p79OgR7t+/j9atW+Pp06f4+++/VeowMTHBgAEDpPdyuRwtWrR45TZfZ8+ePXB1dUWLFi2kMktLywK3uMLDw5GWloZ+/frh/v370ktXVxctW7ZEZGRkgbpHjx5d7Pa8iomJyRtnm73Yh+np6bh//z7atm2LmzdvSrekDh06hJycHHzxxRcq6+YP4i7MyJEjVW7PtW7dGrm5ubh16xYA4ODBg8jKysK4ceOgo/P/p6URI0ZAqVRi9+7dACBdAdq/f/8rx5xs27YNeXl5+PTTT1X62cbGBrVr1y7Qz2/7WfDw8ECtWrWk9w0bNoRSqVRZ/8V+zc7ORmpqKpycnGBmZoa//vpLWvb777+jUaNG6NWrV4HtvHx7c8iQIZDL5dL7N31vXlTc72hRFLffFQoFhgwZolKWfwUpLCwM2dnZhW5n37590NfXV7nSqaOjo3IF82Xq+B4NGjQIlSpVkt5//PHHqFq1Kvbs2aMSp6enh88//1x6L5fL8fnnnyMlJQUxMTEAgK1bt8LZ2Rl169ZV6asOHToAQIG+KspnjN4eEyJSq9zcXGzatAnt27dHfHw8rl+/juvXr6Nly5ZITk7GoUOHCqx
"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()"
]
}
],
"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",
"version": "3.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}