DSA_SS24/notebooks/demographic_plots.ipynb

319 lines
230 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",
2024-06-05 09:53:25 +02:00
"This notebook is used to read the data from the pickle files and to create a dataframe with the demographic data.\n",
2024-06-11 19:04:23 +02:00
"With this data we can create plots to show the distribution of the demographic data."
2024-05-15 20:20:01 +02:00
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
2024-06-11 19:04:23 +02:00
"execution_count": 9,
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-11 19:04:23 +02:00
"from scipy.stats import chi2_contingency\n",
"import sys\n",
"import json\n",
"\n",
"sys.path.append('../scripts')\n",
"import data_helper"
2024-05-15 20:20:01 +02:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Load Data"
2024-05-08 17:45:29 +02:00
]
},
{
"cell_type": "code",
2024-06-11 19:04:23 +02:00
"execution_count": 2,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading GSVT\n",
2024-06-11 19:04:23 +02:00
"Reading AFIB\n",
2024-05-08 17:45:29 +02:00
"Reading SR\n",
2024-06-11 19:04:23 +02:00
"Reading SB\n"
2024-05-08 17:45:29 +02:00
]
}
],
"source": [
2024-06-11 19:04:23 +02:00
"data_demographic = data_helper.load_data(only_demographic=True)\n",
2024-05-08 17:45:29 +02:00
"\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-11 19:04:23 +02:00
"execution_count": 5,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-06-11 19:04:23 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAk0AAAHJCAYAAACYMw0LAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAADLMklEQVR4nOzdd1gUxxsH8O91eu9KEyygWMCGvYKKXWONYoslaiyJhcTEFiU/7C3RxIKJGjUmmth7jdjFAnZRROm9c2V+f1xYPTnkTg8P8f08zz3K7Ozs7O7t7Xszs3M8xhgDIYQQQgh5I76+K0AIIYQQ8iGgoIkQQgghRAMUNBFCCCGEaICCJkIIIYQQDVDQRAghhBCiAQqaCCGEEEI0QEETIYQQQogGKGgihBBCCNEABU2EEEIIIRoo16Dp6NGjGD58OGrUqAEzMzNIJBI4OjqiY8eOWLZsGZKTk8tz8+/FnDlzwOPxMGfOnPe2TTc3N/B4PDx58uS9bfNjMWzYMPB4PISHh+u7KqV6/vw5hgwZAicnJwiFQvB4PAwbNkzrcpYuXQoejwcej4dVq1bpvqIfibd5z4SHh3PHvvglFothY2MDb29vDBo0CD///DOysrJKLePUqVPg8Xho06bNu+/ER+zJkyfg8Xhwc3N7b9t88eIF5syZg5YtW8LBwQFisRimpqaoXr06+vbti/Xr1yMjI+O91YdorlyCppSUFHTs2BEBAQEIDw+HVCpF27Zt0adPH3h5eeH8+fOYOnUqqlWrhosXL5ZHFT5YH8JNuyL6WI4bYwy9e/fGli1bYGlpif79+yM4OBgtWrTQuqwNGzZw/9+4caMuq0k0ZGxsjODgYAQHB2PAgAFo3rw5BAIBduzYgTFjxsDJyQkrV64E/drV26toXzIXL16MatWqYe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LRkA9vnnn5c4Rm/y888/Mz6fzwCwBg0asIEDB7JmzZpx9ZwzZ06J/QwMDGQAmL29vcp+Jicna7zdDRs2cMe/WPG5ftNNYNy4cQwA4/P5rHXr1mzAgAGsdu3aTCAQsC+//LLUG/jbXFdvUhzk2drashYtWrD+/fuzgIAAZm1tzQAwT09PlpKSUmK94uvm22+/ZTwej/n5+bEBAwawpk2bcsd82bJlJdZLSEhg1atXZwCYpaUl6927N+vZsyezsLBgHh4erHv37uUaNBV/rpqYmKgEmG8KmoqDlgYNGrDu3buz3r17M29vb+6zddeuXSXWkcvlrGvXrgwAE4vFLCAggPXv359Vq1aNGRkZcZ+vpQVNPXv2ZHXr1mUWFhasW7durEePHty17urqyjIyMkpsU5troLiO7du35z7jOnfuzAYOHMg6dOjAnd/r168zxpTvk+DgYGZsbMwAsD59+qhcM3fu3GGMvTlgiI2N5Y6bkZER69ixIxswYABr2bIlMzc31+j8McZYWloat5/v0qBQfKyDgoKYu7s7s7S0ZN27d2effPIJGzx4MGNMGVR26NCBAWAGBgasc+fOrH///szZ2Zn7DLt69apKuboImqZMmaJy/23cuDF3HleuXKmyTm5uLqtTpw53HXfr1o0NGDCAtWnThjk4ODAApX750TedBk1DhgxhAFi7du3eav2ffvqJO6nFb3zGlMFUcXBiYWHBkpKSVNYrPmkCgYD9/fffassuPnlmZmYsIiKixPL4+HhmbW3NeDwe+/HHH5lcLueWpaSksHbt2jEAbO7cuSrrlRY0ZWVlsb///rtEUFBUVMRCQkIYANalS5cS9dDkW2tpb97+/fszAKxJkyYqN43s7GzWuXNnBoA1a9ZMZZ1XWzBcXV1VWvNkMhkbMWIEd2N7XfF61tbWLDIykkvPy8tjLVq0YACYj48P8/Dw4IISxpQBgKe
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-06-11 19:04:23 +02:00
"plt.title('Correlationmatrix of Age and Diagnostic Groups ', fontsize=16)\n",
"plt.xlabel('Diagnostic Group')\n",
"plt.ylabel('Age Group')\n",
2024-05-08 17:45:29 +02:00
"plt.show()"
]
},
2024-06-11 19:04:23 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Chi-Square Statistc Test\n",
"\n",
"With this test we want to check if there is a significant difference between the groups."
]
},
2024-06-02 16:27:39 +02:00
{
"cell_type": "code",
2024-06-11 19:04:23 +02:00
"execution_count": 6,
2024-06-02 16:27:39 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-06-11 19:04:23 +02:00
"Chi-Square Statistic: 11503.925605129169\n",
"P-value: 0.0\n",
"Chi-Square Statistic for SB in 60-70 vs others: 401.0271328859626\n",
"P-value for SB in 60-70 vs others: 3.291102770159182e-89\n"
2024-06-02 16:27:39 +02:00
]
}
],
"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-11 19:04:23 +02:00
"execution_count": 7,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-06-11 19:04:23 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlAAAAHJCAYAAABKYwdTAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB2pklEQVR4nO3dd1gURx8H8O/Rjl6VJogoiL03xC6KNRasMbGhxhp7jVFjNBq7xp5Y81qTqFGjxq6xVxQVsaHYAKWIIFLn/QNZPTiU09UD7/t5nnsemJndnd273fvdzOysQgghQERERES5pqftChARERHlNwygiIiIiDTEAIqIiIhIQwygiIiIiDTEAIqIiIhIQwygiIiIiDTEAIqIiIhIQwygiIiIiDTEAIqIiIhIQx8UQO3btw89evRA8eLFYWlpCaVSCScnJzRq1Ahz587FkydP5KrnO02aNAkKhQKTJk36ZNt8H4cPH4ZCoUC9evW0XZXPkkKhgEKh0HY13mrHjh2oXbs2LC0tpfoePnxYo3UcPnwYvXv3RqlSpWBjYwNDQ0PY2dmhWrVqGDhwIPbv34/88JCBIkWKQKFQ4O7du9quSp70Pp/nevXqSctlvszMzODk5AQfHx8MGjQIBw8efOvno3v37lAoFFi9evUH7oFu08b30udybcgPDN5noadPn6Jz587Yv38/gIyLYP369WFmZobw8HCcOHEC+/fvx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E9+7dxcuXL6W8sLAwUahQIQFAOgEyZQYkAETLli1FQkKClHf+/HlhYGAgnUR9+/YVKSkpUv62bds
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-06-11 19:04:23 +02:00
"plt.title('Corleationmatrix of Gender and Diagnostic Group', fontsize=16)\n",
"plt.xlabel('Diagnostic Group')\n",
"plt.ylabel('Gender')\n",
2024-05-08 17:45:29 +02:00
"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-11 19:04:23 +02:00
"execution_count": 14,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-06-11 19:04:23 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnYAAAHbCAYAAABGPtdUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAACHw0lEQVR4nO3de1zO9/8/8MfV6apQyaFEJYeV86GUnCklbRg+HwzLeXzCyOYwc2b5GDPGmIm2D81hwwyjltOQU+Qw5JTFKKMlFXXV9fr94df761JxXbquroPH/Xa7brrer9f1ej/fXdf19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tRW5ubqkx0ZuDh2JJ8uLhshcfhw4d0mi89PR0AED37t2Ltdnb26N169YajZeamoqtW7dCJpNhzZo1qFKlitRWsWJFfPvtt7C2tsaxY8dw7NgxqS0qKgrZ2dnw9/fH+PHjVcbs0KEDxowZ88p1f/TRR6XG26pVKzRu3LjYchcXFyxatAgAsHXr1lLHXr58Odzd3aXnVapUkWK6ePEioqKiVLbVw8MDgwYNAvBsr6i6Fi9eDAD4z3/+g65du6q0DR8+HG+//TYUCgWWLVum9pjaNHfuXPj5+aksmzZtGuzt7XH16lWVQ6uXL1/GDz/8ABcXF8TExKB69eoqr5swYQK6d++Oa9eu4ddff9UojqKLJgYPHiydz2VtbY333ntPpf15v//+O86cOYOKFSti5cqVkMvlUlvNmjV
2024-05-08 17:45:29 +02:00
"text/plain": [
"<Figure size 640x480 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-06-11 19:04:23 +02:00
"settings = json.load(open('../settings.json'))\n",
"categories_dict = settings['labels']\n",
2024-05-08 17:45:29 +02:00
"# 4 subplots for each diagnosis a histrgramm for the age\n",
"fig, axs = plt.subplots(2, 2)\n",
2024-06-11 19:04:23 +02:00
"fig.suptitle('Histogram of the Age Distribution', 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",
2024-06-11 19:04:23 +02:00
" ax.set_xlabel('Age')\n",
" ax.set_ylabel('Amount of Patients')\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-11 19:04:23 +02:00
"execution_count": 11,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-06-11 19:04:23 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAk0AAAHHCAYAAACiOWx7AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABdwklEQVR4nO3dd3xN9/8H8NfNuDdLpkySCLFiz4gURYi9W1oliNE29tZhj9aepZSEllKrVRQRq4gtRmmsEC1JkE3mzef3h1/O15WEc7lxr3o9H488Hs7nfM4573NPxsvnnPu5CiGEABERERG9kJG+CyAiIiJ6GzA0EREREcnA0EREREQkA0MTERERkQwMTUREREQyMDQRERERycDQRERERCQDQxMRERGRDAxNRERERDIwNBH9h8yZMwdly5aFsbExatasqe9y0KdPH5QpU0bfZbwzFAoFJk+erO8y3qgyZcqgT58++i6D3hEMTWRwvvvuOygUCvj6+uq7lGKxYcMGLFy4UOf73bdvH8aOHQt/f3+EhoZi5syZRfbt06cPFAqF9GVtbY0aNWpg3rx5yMrK0uq49+7dw+TJkxEVFfWaZ/Bqrly5gsmTJ+P27dt6OX5xKVOmjHR9jIyMYGtri2rVqmHgwIE4efKkvst7o44fP47JkycjOTm52I+Vl5eHdevWoUWLFihZsiRMTU3h5OSEli1bYuXKlVr/fNB/i4KfPUeGxt/fH/fu3cPt27dx/fp1eHt767sknWrXrh0uX76s8z/y48ePx5w5c5CRkQGlUvnCvn369MHGjRvxww8/AACSk5OxdetWHDp0CN27d8fGjRtlH/fMmTOoV68eQkNDC/yPPycnB3l5eVCpVFqfj1xbtmzBBx98gIMHD+L9998vtuO8aWXKlIGdnR1GjRoFAEhLS8PVq1exefNmxMXFYcSIEZg/f77GNpmZmTAxMYGJiYk+Si42c+fOxZgxYxATE1Ng5DIrKwtGRkYwNTV97eNkZGSgc+fO2L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LlxbDhg3T6Jf/vztHR0eRnJwstU+YMEEAEDVq1BA5OTlS+0cffSSUSqU0MpOQkCCUSqVo2bKlxmjA0qVLBQCxZs0aqU3bkabKlSuLrKwsqX3RokUCgLh06ZLU1rZt25eOLuWLiooSAET//v012vNHhA4cOCC1FTV6VJj8vg8ePBAPHjwQN27cEDNnzhQKhUJUr15dCCFEZmamxusjxNPXXqVSialTp0ptp0+fLnJk6/n/Rf/5558CgDSKkG/Pnj0F2j09PQUAceTIEaktISFBqFQqMWrUKKlt8+bNGqNL+bZv3y4AiNOnT8t6TZ6Vf+xnR5ZSUlKEq6urqFWrltQ2bdo0YWlpKa5du6ax/fjx44WxsbGIjY0VQvzve9ba2lokJCTIrqGokSYhhFiwYIEAIH777TepDc+NND158qTAdpGRkQKAWLdundQ2ZMgQoVAoNEa+Hj16JOzt7QsdaZJzXYYPHy4AiD///FNqS0tLE15eXqJMmTLS91bHjh1FlSpVXvhazJkzp0Adz9bz7M/oxIkTBQCxbdu2An2fHZV73ogRIwQAjZFUIYTIysqSfk4ePHggHj58KK170XWtWbOmcHJy0hjlvnDhgjAyMhK9e/eW2rQdaQIgzpw5I7XduXNHmJmZic6dOxd5bqQ7fPccGYz169fD2dkZTZs2BfD07dP5DyWr1eoC/T/44APY2NhIy/nvtvvkk080HoT19fVFdnY2/v33XwDA/v37kZ2djeHDh8PI6H8/AgMGDIC1tTV27dr1yufQt29fjWcZ8kdebt269Ur72717NwBg5MiRGu35Dwe/Tq2PHz+Go6MjHB0d4e3tjS+++AJ+fn7S6JVKpZJeH7VajUePHsHKygo
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",
2024-06-11 19:04:23 +02:00
"plt.title('Amount of Patients per Diagnostic Group')\n",
"plt.xlabel('Diagnostic Group')\n",
"plt.ylabel('Amount of Patients')\n",
2024-05-08 17:45:29 +02:00
"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",
2024-06-11 19:04:23 +02:00
"execution_count": 13,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-06-11 19:04:23 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAHHCAYAAABeLEexAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABsVklEQVR4nO3dd3xN9/8H8NfNutmDLCGJELOIihX5Ejs2bZSqvSlVoyi1qjVKiV1VI/ZsjdqbllB7FLFiFIk2ZFiZ798fHvf8XBlyk3sT3Nfz8biPR87nfM457/e55577zllXJSICIiIiIiNmkt8BEBEREeU3FkRERERk9FgQERERkdFjQURERERGjwURERERGT0WRERERGT0WBARERGR0WNBREREREaPBREREREZPRZE9M6YOnUqihUrBlNTU1SsWDG/w0GXLl1QtGjR/A6D6K1y8OBBqFQqHDx4UO/zHjduHFQqld7n+zYLCwuDSqXCrVu38juU9x4Lojw2b948qFQqVKtWLb9DMYhVq1ZhxowZep/v7t27MWzYMAQGBmLJkiWYOHFipn27dOkClUqlvOzt7eHn54dp06YhMTFRp+Xev38f48aNw9mzZ3OZQc5cunQJ48aNe293hqmpqfDw8IBKpcKOHTvyOxwAwPnz59G1a1f4+PjA0tIStra2qFixIoYNG4abN2/md3jvDc0XveZlaWkJDw8PBAcHY9asWUhISMjvEPPUxIkTsWnTpjxZVmRkJPr374+SJUvC2toa1tbWKFu2LPr164fz58/nSQxvJaE8VaNGDSlatKgAkGvXruV3OHrXtGlT8fb21v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JEjZc6cOVKpUiVRqVRy8eJFERG5ceOGDBgwQADIyJEjleVHRUVJdHS0ODk5KTugX375Rb755hspU6ZMlutbs+ySJUuKo6OjfP311zJ9+nQpX768mJiYyO7du5V+T58+lQoVKkjBggVl5MiRMn/+fOnUqZOoVCrlS1/k/7fZsmXLSrFixWTy5MkSGhoqt2/fzjKONWvWiEqlkjt37oiISN26daVJkybp+m3dulVUKpVUqFBBpk+fLqNHjxYnJycpV65cjtf/654+fSpmZmZSv379N66/VwUFBYm7u7u4uLjIF198IT///LNs2rRJnj17JmXKlBFzc3MZNGiQzJo1S2rWrCkAZMaMGcr0uhZElpaWUqJECenYsaPMmTNHmjVrJgBk9OjRb4y1VatW0qZNG5k6dar89NNP8sknnwgA+eqrr9Ll5OHhIZ6envLll1/KvHnzpG7dugJAtm/frvR79uyZlCxZUiwtLWXYsGEyY8YM8ff3lwoVKuilILp7966yb9DIqCCqUqWKdOnSRUJDQ2X27NnSsGFDASBz5szR6jds2DABIM2bN5c5c+ZIz549pUiRIuLs7JxhQfThhx9K3bp1Zfbs2TJkyBAxNTWVNm3aaM0zO/vaxMRE8fHxEQ8PD/n+++9l4cKF8u2330qVKlWUU1PLly8XtVotNWvWVD7nR48e1Yrn1YJoyZIlolKppFy5cjJhwgSZO3eu9OjRQzp27JjlOvfw8BBfX98s+7xOcwlC8eLFpXPnzjJ//nxZtmyZpKWlSd26dUWlUkmPHj1kzpw50rx5cwEgAwcOVKbPSUFUvnx55X3q0KGDAHhjbvrAgiiPnDx5UgDInj17REQkLS1NihQpovXFIvL/G4+Li4vy34OIyIgRIwSA+Pn5SXJystLerl07sbCwUI6oPHz4UCwsLKRhw4Za/8XPmTNHAMjixYuVNl0LojJlymhdwzNz5kwBIBcuXFDadLmG6OzZswJAevToodWuOZKzf/9+pS2zIicjmr7//vuv/Pvvv3L9+nWZOHGi8qUqIvLixQut9SP
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",
2024-06-11 19:04:23 +02:00
"plt.title('Amount of Patients per Age Group and Diagnostic Group')\n",
"plt.xlabel('Age Group')\n",
"plt.ylabel('Amount of Patients')\n",
2024-05-08 17:45:29 +02:00
"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-06-11 19:04:23 +02:00
"version": "3.10.4"
2024-05-08 17:45:29 +02:00
}
},
"nbformat": 4,
"nbformat_minor": 2
}