DSA_SS24/notebooks/demographic_plots.ipynb

303 lines
216 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-05-15 20:20:01 +02:00
"execution_count": 1,
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-05-15 20:20:01 +02:00
"import pickle"
]
},
{
"cell_type": "code",
"execution_count": null,
"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",
"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": [
"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",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmUAAAHJCAYAAADEuU4vAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAADPcElEQVR4nOzdd3gUxf/A8ffdJXfpjZAESCChg/QeQKRJaAICUkQMTYoUAQVEUBClqKigqKggoIBf0J+oSBPpCiJFaugtlCSE9N5ufn/EHBxJIAlHCnxez3MPZHZ2dnb3bvdzM7NzGqWUQgghhBBCFCltUVdACCGEEEJIUCaEEEIIUSxIUCaEEEIIUQxIUCaEEEIIUQxIUCaEEEIIUQxIUCaEEEIIUQxIUCaEEEIIUQxIUCaEEEIIUQxIUCaEEEIIUQzkOyjz9fVFo9GwfPnyHJeHh4fTqFEjNBoNTzzxBNevX3/QOhaJmTNnotFomDlzZqFtM+vYXr58udC2KXKm0WjQaDRFXY0S56OPPjIdu08//fSeeXfu3IlGo6F169aFUzkhikhBru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zerb5cuXZSfn59ydXVV3bp1U88995waMGCAqbyscu7WrVs3Bah+/fqZpR85ckTZ2NgoKysr9ddff2VbLydffvmlAlRAQECueRo0aKAA9euvv5rSHvTz9OabbyqNRqMaNmyo+vXrp5o1a2ba348//jhPdb/b0qVLFaDq1KljSsuqz6pVq3JcZ8eOHQpQTz31lCktr+dRKaXWrl1ruv5Ur15dPfvss6pt27bK3t5eAWrw4MHZtvnUU08pQL388stKq9WqmjVrqn79+qkOHTqo1atXK6WUGjx4sAKUjY2Nat++verfv78KCAhQVapUUYDZZ1YppU6ePGn6LJYtW1b16dNHdenSRdnb26uWLVuq5s2bK0Dt2LEj33XJOhbLli3L8RhmvZ8DAwNzTO/WrZuqVKmScnFxUT169FDPPvus6bpXrVo1dfPmzRzPib+/v2rWrJmys7NTnTt3Vs8995wqU6aMApSXl5c6e/ZstrqcPHlS+fj4KECVKVNGdezYUT3zzDPK09NTAapevXoqOjrabJ2s6+yQIUOUt7e38vT0VD179lSdO3dWzs7OClCNGzfOdn2+l9yOSZY7r425pefnmqmUUnv27DG97ypWrKj69eun2rdvr6ytrVWvXr1yvbbfS9a5z20/7vTss8/meC2x1H0sy40bN0z3Mjc3N9WzZ0/Vo0cP5erqqqpVq6Z69OiR4/s1a19eeeUV5eTkpCpUqKD69Omj2rdvb7pP9OjRI9v2CnKtCwkJMe1H+fLlVffu3VXfvn3Vk08+qdzc3JSzs3O27RQkRijoPt1PgYOyLl26KCsrKwWoDz744J7rfPHFFwpQ7u7u6t9//zWlG41G05vGxcUl2wUia1s6nU798ssvOe/AfxdvJycntW/fvmzLQ0JCVKlSpZRGo1Gff/65ysjIMC27deuWatu2rQLU22+/bbZebm/m2NhY9csvv6iUlBSz9NTUVDV16lQFqM6dO2erx/0urnfu790f3L59+ypANW3aVN26dcuUHhcXpzp16qQA1bx5c7N1si4wWReZM2fOmJalp6erIUOGmN5sd8q6Ib377rvZ6peYmKh27dpllpZ1AQTUM888oxISEkzLDh06pKysrEw3nJEjR6q0tDTT8p9//tl07u5cTyml/vnnH3X8+PFsdbh+/bqqW7euAtTatWuzLc8tmMqpvu3atVMxMTE55sutnKioKOXr66sA9cUXXyilMt8TWTfs+30W7hQTE6Ps7OyUVqtV165dy7b86NGjClCenp5mx+1BP0/W1tZ
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-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",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlIAAAHJCAYAAABOltduAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB2pUlEQVR4nO3dd1QUVxsG8GeXsvSmAlIEFOwdjb2j2HtBsYI1do29G42R2BNLTKyJ9TNq1Nh7LLGj2BuKDUSKSJF6vz8IE1aKwK4uss/vnD2HvXNn5p3Z3dmXe+/clQkhBIiIiIgo1+SaDoCIiIjoS8VEioiIiCiPmEgRERER5RETKSIiIqI8YiJFRERElEdMpIiIiIjyiIkUERERUR4xkSIiIiLKIyZSRERERHmU60TK2dkZMpkM69evz3R5aGgoqlWrBplMhnLlyuHFixeqxqgRM2fOhEwmw8yZMz/bPtPO7ZMnTz7bPilzMpkMMplM02F8UV6+fImZM2eiXr16sLW1hb6+PkxNTeHm5obOnTvj119/RWRkpKbDzLG8fh779u2b7TXyU9P0/vOLkydPQiaToWHDhrlaL+2zn/aQy+UwNzeHk5MTPD09MXXqVNy+fTvbbfBarl3U2iL17Nkz1KtXD1euXMFXX32F06dPw97eXp27+GLx4vZ5MAHSjAULFqB48eKYNWsWrly5glKlSqFjx47w9PSEpaUldu/ejQEDBsDJyQlnzpzRdLiUifXr10Mmk6Fv376aDiVf8PT0RJ8+fdC7d280a9YMzs7OOHfuHObOnYty5cqhU6dOeP36tabDpHxAV10bunfvHpo2bYpnz57Bw8MDu3btgomJibo2rxWOHTuGxMREJp/5wJ07dzQdwhdjwoQJ8PPzg76+Pvz8/DBs2DAYGhoq1Xn79i3WrVuH+fPn4/nz5xqKlCjnJk6cmKE1KykpCdu3b8eYMWOwc+dO3L59G+fOnYOlpaVSPV7LtYtaEqmrV6+iefPmCA0NRadOnbB582bo6+urY9NapUSJEpoOgf5VunRpTYfwRTh69Cj8/PwAANu3b0e7du0yrWdubo5Ro0ahT58+CAsL+5whEqmNrq4uevTogbp168Ld3R13797FN998gzVr1ijV47Vcu6jctXf69Gk0atQIoaGhGDBgALZv355lErV161Y0adIEVlZWUCgUcHJygo+PD+7fv59p/fT9zH/++ScaN24MKysryGQynDx5EoByV866detQq1YtmJubZ+iffvnyJcaMGYMyZcrAyMgIpqamqF69On766SckJSXl+HgTExPx+++/w9vbG6VLl4aZmRkMDQ1RqlQpjBgxAi9fvlSq/+TJE8hkMmzYsAEA0K9fP6X+9/RjsLLrV4+NjcX333+PqlWrwtTUFEZGRihXrhymTp2KiIiIDPXT9uvs7AwhBFavXg13d3cYGxvD3NwczZo1w/nz5zM9xg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UzUqFFDdOvWTbRt21ZUrVpV6OjoiJEjR2bYz9ixY6XX76uvvhJdunQRNWrUEDKZTOjo6Ii1a9eq7Zg+pTwnUq1atRK6uroCgPjhhx+yXWflypUCgChcuLC4du2aVJ6SkiJ9iCwsLMTr168z3ZeOjo74888/Mz+Af0+qmZmZOH/+fIblr169EoUKFRIymUysWLFCJCcnS8vevHkjGjdunOkFLKsPfVRUlPjzzz9FfHy8UnlCQoKYNGmSACBatmyZIY7sLq4fHu+HH75u3boJAKJGjRrizZs3Uvm7d+9EixYtBABRu3ZtpXXSEqm0ZOrevXvSsqSkJOHj4yMlken169dPABBz5szJEF9sbKw4deqUUllaYgJAtGnTRsTExEjLrly5InR1dYVcLhdly5YVgwc
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",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "iVBORw0KGgoAAAANSUhE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179xbPPPOM9L49reT37o033hBmZmbC19dXjBw5UgQHB4uNGzcKIYSIjIwUAISVlZUICgoSo0aNEiEhIdL7smPHDml7o0aNEgDUfq+edOPGDSGXy4VcLhc3btyQ2pVKpXj55ZcFAKFQKETXrl3FSy+9JNq1aycACGtra/Hjjz+qbavkc+7u7i4GDRok5HK56NOnjxg1apRo27at+O2330RERIRwcnISAERISIjaz+7nn3+WtnX+/Hnh5uYmAAgXFxfRr18/MXDgQOm17du3F3fu3FHbf1xcnPSelBWXh4eHRu1PKsmXT+eZkvYPPvhAyGQy4e/vL0aOHCm6dOkifTaWL19eanvXr18XzZo1EwBEgwYNpN+f+vXrC29vbzFkyBCN8jPVPSzqqEy6Kup69eolAIjvvvuu1Lbu3LkjUlNT1drKS8BPGjFihAAgAgIC1P7BuXfvnujfv78AILp27ar2mn/++UfY2toKAGLlypVqfYcOHZL+Qa2oqLOzsysVb4njx4+Ls2fPlmr/559/pH/wtm7dqtZX8o9HSRH7ZDFy48YN6R/jNm3aiM6dO6sd69WrV0X9+vUFAHH48GG17ZYUdQDEhAkThFKplPp27twpAIh69eoJDw8P8eGHH6oVmytWrBAARPPmzcs8zvIMHz5cABDPP/+82j+qN2/eFAEBAVI8T3++vvrqK2l/p0+fVus7dOiQqFevnpDL5eLy5ctqfZq8J5ro2rWrACBWrFghtcXExAgAonfv3mW+przP+pNxlefMmTNCoVAIKysr8b///U+t788//xRt2rQRAMQ333yj1lfyewdArF69utR2//rrLwFANG3aVGRlZZXqv3Dhgvjrr7+k54mJiVJRWZaVK1cKACIsLEyt/b333pN+965evarWt23bNmFubi7q168vbt++LbU/+Tlv2rSpuHTpUpn7LDnGgwcPltlfUFAgFT6zZ88WhYWFUl9+fr5UqD5dFOujqLO0tBS7du0qMw57e3tRUFCg1jd06FABQPTs2VPcvXtXar99+7bo3r17ub8/RCzqqEwlyUjTh6ZFna+vrwAgbt26pVEclRV1f/31lzAzMxMymaxUESCEEH///bd0FuSXX36R2hcsWCAAiMDAwDK3+84771Ra1C1YsECjY3javn37BADx0ksvqbU/+Y/d7t27S71u2bJlAoCQyWRlFoyTJ08WAMT8+fPV2kuKOnd3d/HgwYNSr2vbtq0AIDp37lzq7KFSqRQNGjQQANSKgIpkZmZK78n58+dL9Z86darMf5SKi4uFq6urACBOnjxZ5raXLFkiAIhp06aptdf0PRFCiN9++00AKHU26vr168Lc3FzIZLJShYsQNSvqSv4gWbp0aZn9x48fFwCEv7+/WntJwVNeoVnyukGDBpW77yepVCrpd/7IkSOl+kvOhCckJEhtN2/eFNbW1sLKykr8/fffZW73jTfeEADEqlWrpLYnP+fffvttuTFVVtStWbNGABADBgwos//evXvC0dFRWFhYqOUbfRR1U6dOLfN1Pj4+AoBISUmR2v78808hk8mEmZmZ+O2330q95uzZs0Imk7GoozJxTh1VqFu3boiIiCj34eTkVKXtde7cGQAQHh6Ow4cP49GjRzWKLyUlBSqVCn5+fmjbtm2p/iZNmiAkJAQAcPDgQam9ZL5OeHh4mdstr/1Jw4cPr7C/sLAQu3btwpw5czBhwgRERkbi1VdfxZdffgkAuHTpUpmvs7CwQHBwcKn2Fi1aAADc3d3RunXrcvuvX79e5nZ79eoFKyurcl/Xv3//UnMILSwspLlE5W33aSXvSYcOHeDr61uqv3379mW+V6d
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",
"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+XdVllWmPHj2CoaHha8d07Ng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/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()"
]
},
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/y7vxcFxRkYdW5P9e118WceWbmPLM7uw+zc2YVQggBIiIiIhnT03UHiIiIiHSNBRERERHJHgsiIiIikj0WRERERCR7LIiIiIhI9lgQERERkeyxICIiIiLZY0FEREREsseCiIiIiGSPBRHJTosWLVC7du2XxiUnJ0OhUCAqKuqVthMVFQWFQoHk5ORXWr6sTZw4EQqFQtfdoBKKjY2FQqHA77//Xi7bUygUmDhxYrlsi0iXWBBRmVm4cCEUCgWaNGmi66689VTFl+phbGwMZ2dnBAYG4qeffsKDBw903UV6Db3KMXrkyBFMnDgRGRkZZdcxIh1gQURlZuXKlahcuTKOHz+Oq1ev6ro7sjB58mSsWLECixYtwrBhwwAAI0aMQJ06dXDmzBm12HHjxuHJkye66Ca9Jl7lGD1y5AgmTZrEgojeOiyIqEwkJSXhyJEjmDVrFuzt7bFy5Updd+mN9+jRo5fGtG/fHj179kTfvn0RFhaGnTt3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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",
"version": "3.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}