560 lines
221 KiB
Plaintext
560 lines
221 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Exercise 2: Example for pandas using the heart.csv data set"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import matplotlib.pyplot as plt"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# read the csv Data \n",
|
||
|
"df = pd.read_csv('heart.csv')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Index(['age', 'sex', 'cp', 'trestbps', 'chol', 'fbs', 'restecg', 'thalach',\n",
|
||
|
" 'exang', 'oldpeak', 'slope', 'ca', 'thal', 'target'],\n",
|
||
|
" dtype='object')\n",
|
||
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
||
|
"RangeIndex: 303 entries, 0 to 302\n",
|
||
|
"Data columns (total 14 columns):\n",
|
||
|
" # Column Non-Null Count Dtype \n",
|
||
|
"--- ------ -------------- ----- \n",
|
||
|
" 0 age 303 non-null int64 \n",
|
||
|
" 1 sex 303 non-null int64 \n",
|
||
|
" 2 cp 303 non-null int64 \n",
|
||
|
" 3 trestbps 303 non-null int64 \n",
|
||
|
" 4 chol 303 non-null int64 \n",
|
||
|
" 5 fbs 303 non-null int64 \n",
|
||
|
" 6 restecg 303 non-null int64 \n",
|
||
|
" 7 thalach 303 non-null int64 \n",
|
||
|
" 8 exang 303 non-null int64 \n",
|
||
|
" 9 oldpeak 303 non-null float64\n",
|
||
|
" 10 slope 303 non-null int64 \n",
|
||
|
" 11 ca 303 non-null int64 \n",
|
||
|
" 12 thal 303 non-null int64 \n",
|
||
|
" 13 target 303 non-null int64 \n",
|
||
|
"dtypes: float64(1), int64(13)\n",
|
||
|
"memory usage: 33.3 KB\n",
|
||
|
"None\n",
|
||
|
"age int64\n",
|
||
|
"sex int64\n",
|
||
|
"cp int64\n",
|
||
|
"trestbps int64\n",
|
||
|
"chol int64\n",
|
||
|
"fbs int64\n",
|
||
|
"restecg int64\n",
|
||
|
"thalach int64\n",
|
||
|
"exang int64\n",
|
||
|
"oldpeak float64\n",
|
||
|
"slope int64\n",
|
||
|
"ca int64\n",
|
||
|
"thal int64\n",
|
||
|
"target int64\n",
|
||
|
"dtype: object\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# What is the number of columns and rows\n",
|
||
|
"print(df.columns)\n",
|
||
|
"print (df.info())\n",
|
||
|
"print(df.dtypes)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" age sex cp trestbps chol fbs restecg thalach exang oldpeak slope \\\n",
|
||
|
"0 63 1 3 145 233 1 0 150 0 2.3 0 \n",
|
||
|
"1 37 1 2 130 250 0 1 187 0 3.5 0 \n",
|
||
|
"2 41 0 1 130 204 0 0 172 0 1.4 2 \n",
|
||
|
"\n",
|
||
|
" ca thal target \n",
|
||
|
"0 0 1 1 \n",
|
||
|
"1 0 2 1 \n",
|
||
|
"2 0 2 1 \n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# get first 3 lines\n",
|
||
|
"print(df.head(3))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" age sex cp trestbps chol fbs \\\n",
|
||
|
"count 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 \n",
|
||
|
"mean 54.366337 0.683168 0.966997 131.623762 246.264026 0.148515 \n",
|
||
|
"std 9.082101 0.466011 1.032052 17.538143 51.830751 0.356198 \n",
|
||
|
"min 29.000000 0.000000 0.000000 94.000000 126.000000 0.000000 \n",
|
||
|
"25% 47.500000 0.000000 0.000000 120.000000 211.000000 0.000000 \n",
|
||
|
"50% 55.000000 1.000000 1.000000 130.000000 240.000000 0.000000 \n",
|
||
|
"75% 61.000000 1.000000 2.000000 140.000000 274.500000 0.000000 \n",
|
||
|
"max 77.000000 1.000000 3.000000 200.000000 564.000000 1.000000 \n",
|
||
|
"\n",
|
||
|
" restecg thalach exang oldpeak slope ca \\\n",
|
||
|
"count 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 \n",
|
||
|
"mean 0.528053 149.646865 0.326733 1.039604 1.399340 0.729373 \n",
|
||
|
"std 0.525860 22.905161 0.469794 1.161075 0.616226 1.022606 \n",
|
||
|
"min 0.000000 71.000000 0.000000 0.000000 0.000000 0.000000 \n",
|
||
|
"25% 0.000000 133.500000 0.000000 0.000000 1.000000 0.000000 \n",
|
||
|
"50% 1.000000 153.000000 0.000000 0.800000 1.000000 0.000000 \n",
|
||
|
"75% 1.000000 166.000000 1.000000 1.600000 2.000000 1.000000 \n",
|
||
|
"max 2.000000 202.000000 1.000000 6.200000 2.000000 4.000000 \n",
|
||
|
"\n",
|
||
|
" thal target \n",
|
||
|
"count 303.000000 303.000000 \n",
|
||
|
"mean 2.313531 0.544554 \n",
|
||
|
"std 0.612277 0.498835 \n",
|
||
|
"min 0.000000 0.000000 \n",
|
||
|
"25% 2.000000 0.000000 \n",
|
||
|
"50% 2.000000 1.000000 \n",
|
||
|
"75% 3.000000 1.000000 \n",
|
||
|
"max 3.000000 1.000000 \n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"#display statistics summary\n",
|
||
|
"print(df.describe())"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" age sex cp trestbps chol fbs \\\n",
|
||
|
"age 1.000000 -0.098447 -0.068653 0.279351 0.213678 0.121308 \n",
|
||
|
"sex -0.098447 1.000000 -0.049353 -0.056769 -0.197912 0.045032 \n",
|
||
|
"cp -0.068653 -0.049353 1.000000 0.047608 -0.076904 0.094444 \n",
|
||
|
"trestbps 0.279351 -0.056769 0.047608 1.000000 0.123174 0.177531 \n",
|
||
|
"chol 0.213678 -0.197912 -0.076904 0.123174 1.000000 0.013294 \n",
|
||
|
"fbs 0.121308 0.045032 0.094444 0.177531 0.013294 1.000000 \n",
|
||
|
"restecg -0.116211 -0.058196 0.044421 -0.114103 -0.151040 -0.084189 \n",
|
||
|
"thalach -0.398522 -0.044020 0.295762 -0.046698 -0.009940 -0.008567 \n",
|
||
|
"exang 0.096801 0.141664 -0.394280 0.067616 0.067023 0.025665 \n",
|
||
|
"oldpeak 0.210013 0.096093 -0.149230 0.193216 0.053952 0.005747 \n",
|
||
|
"slope -0.168814 -0.030711 0.119717 -0.121475 -0.004038 -0.059894 \n",
|
||
|
"ca 0.276326 0.118261 -0.181053 0.101389 0.070511 0.137979 \n",
|
||
|
"thal 0.068001 0.210041 -0.161736 0.062210 0.098803 -0.032019 \n",
|
||
|
"target -0.225439 -0.280937 0.433798 -0.144931 -0.085239 -0.028046 \n",
|
||
|
"\n",
|
||
|
" restecg thalach exang oldpeak slope ca \\\n",
|
||
|
"age -0.116211 -0.398522 0.096801 0.210013 -0.168814 0.276326 \n",
|
||
|
"sex -0.058196 -0.044020 0.141664 0.096093 -0.030711 0.118261 \n",
|
||
|
"cp 0.044421 0.295762 -0.394280 -0.149230 0.119717 -0.181053 \n",
|
||
|
"trestbps -0.114103 -0.046698 0.067616 0.193216 -0.121475 0.101389 \n",
|
||
|
"chol -0.151040 -0.009940 0.067023 0.053952 -0.004038 0.070511 \n",
|
||
|
"fbs -0.084189 -0.008567 0.025665 0.005747 -0.059894 0.137979 \n",
|
||
|
"restecg 1.000000 0.044123 -0.070733 -0.058770 0.093045 -0.072042 \n",
|
||
|
"thalach 0.044123 1.000000 -0.378812 -0.344187 0.386784 -0.213177 \n",
|
||
|
"exang -0.070733 -0.378812 1.000000 0.288223 -0.257748 0.115739 \n",
|
||
|
"oldpeak -0.058770 -0.344187 0.288223 1.000000 -0.577537 0.222682 \n",
|
||
|
"slope 0.093045 0.386784 -0.257748 -0.577537 1.000000 -0.080155 \n",
|
||
|
"ca -0.072042 -0.213177 0.115739 0.222682 -0.080155 1.000000 \n",
|
||
|
"thal -0.011981 -0.096439 0.206754 0.210244 -0.104764 0.151832 \n",
|
||
|
"target 0.137230 0.421741 -0.436757 -0.430696 0.345877 -0.391724 \n",
|
||
|
"\n",
|
||
|
" thal target \n",
|
||
|
"age 0.068001 -0.225439 \n",
|
||
|
"sex 0.210041 -0.280937 \n",
|
||
|
"cp -0.161736 0.433798 \n",
|
||
|
"trestbps 0.062210 -0.144931 \n",
|
||
|
"chol 0.098803 -0.085239 \n",
|
||
|
"fbs -0.032019 -0.028046 \n",
|
||
|
"restecg -0.011981 0.137230 \n",
|
||
|
"thalach -0.096439 0.421741 \n",
|
||
|
"exang 0.206754 -0.436757 \n",
|
||
|
"oldpeak 0.210244 -0.430696 \n",
|
||
|
"slope -0.104764 0.345877 \n",
|
||
|
"ca 0.151832 -0.391724 \n",
|
||
|
"thal 1.000000 -0.344029 \n",
|
||
|
"target -0.344029 1.000000 \n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"#display correlation\n",
|
||
|
"print (df.corr())"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" age sex cp trestbps chol fbs \\\n",
|
||
|
"target \n",
|
||
|
"0 56.601449 0.826087 0.478261 134.398551 251.086957 0.159420 \n",
|
||
|
"1 52.496970 0.563636 1.375758 129.303030 242.230303 0.139394 \n",
|
||
|
"\n",
|
||
|
" restecg thalach exang oldpeak slope ca thal \n",
|
||
|
"target \n",
|
||
|
"0 0.449275 139.101449 0.550725 1.585507 1.166667 1.166667 2.543478 \n",
|
||
|
"1 0.593939 158.466667 0.139394 0.583030 1.593939 0.363636 2.121212 \n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Print mean values for each column with and without disease\n",
|
||
|
"print(df.groupby('target').mean())"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" age sex cp trestbps chol fbs restecg thalach exang oldpeak \\\n",
|
||
|
"167 62 0 0 140 268 0 0 160 0 3.6 \n",
|
||
|
"181 65 0 0 150 225 0 0 114 0 1.0 \n",
|
||
|
"182 61 0 0 130 330 0 0 169 0 0.0 \n",
|
||
|
"190 51 0 0 130 305 0 1 142 1 1.2 \n",
|
||
|
"204 62 0 0 160 164 0 0 145 0 6.2 \n",
|
||
|
"\n",
|
||
|
" slope ca thal target \n",
|
||
|
"167 0 2 2 0 \n",
|
||
|
"181 1 3 3 0 \n",
|
||
|
"182 2 0 2 0 \n",
|
||
|
"190 1 0 3 0 \n",
|
||
|
"204 0 3 3 0 \n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# get table with selection on more than 1 column\n",
|
||
|
"df1 = df[(df[\"sex\"] == 0) & (df[\"target\"] == 0) ]\n",
|
||
|
"print (df1.head(5))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
" Plots"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 9,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"0 63\n",
|
||
|
"1 37\n",
|
||
|
"3 56\n",
|
||
|
"5 57\n",
|
||
|
"7 44\n",
|
||
|
" ..\n",
|
||
|
"295 63\n",
|
||
|
"297 59\n",
|
||
|
"299 45\n",
|
||
|
"300 68\n",
|
||
|
"301 57\n",
|
||
|
"Name: age, Length: 207, dtype: int64\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<matplotlib.legend.Legend at 0x7f1561e442e0>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 9,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAA9hAAAPYQGoP6dpAABA0ElEQVR4nO3deXyNZ/7/8fchyZHIgpANlahYY6nqqKUNVRQ1VFtKq9YpZVpLtaqoaNU6UmYMtbTBV1HVUq2x1ZIuhoZSmnRUbUETaa0RFUuu3x9+OY8eSUgicXLzej4eeUzv677u+/6c6yTOe677OufYjDFGAAAAFlXM1QUAAADcCsIMAACwNMIMAACwNMIMAACwNMIMAACwNMIMAACwN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c2//4xz+MJHPmzJkczx8XF2ckmZiYmCz7evToYSSZDz74INt9f76WMcZIMp6eniY5OdnRduXKFVO9enVTpUoVR9uYMWNMdv8UxMTEGEnm0KFDjrZatWqZyMjILH0PHTqUpe4HH3zQBAQEmNTUVKfrR0REmAoVKpiMjAyn6wwYMMDpnJMnTzaSTFJSUpbr3ciVK1fM+fPnTcmSJc306dMd7b179zbu7u4mISEhx2PfeustI8ls2LAhxz7vvfeekWSWLVvm1D5p0iQjyaxfv97RJsn4+fmZU6dOOfXt0qVLjs/N9WMeGRnpNOaZY127dm1z5coVR/t3331nJJklS5YYY679TgcFBZmGDRs6XfvIkSPG3d09y+9LdnJ6vl9//XUjyWzfvt2p/cUXXzQ2m83s27fvhuddvXq1KVu2rJFkJBl/f3/z9NNPm1WrVjn1mzBhgilWrJiJi4tzal++fLmRZP7zn/842vbv3298fX1Nx44dzZdffmmKFStmRo0addPHiDsDt5lQpF25ckXjx49XzZo15eHhITc3N3l4eGj//v366aefHP1iY2MVERGRZX1B165dnba3bt2qU6dOqUePHrpy5YrjJyMjQ4899pji4uKcpq+vt3nzZtWqVUt169Z1au/WrdtNH0vmLaTOnTtr2bJlOn78+E2Pyc6TTz6Z676Z0+yZihcvri5duuiXX37RsWPH8nX93EhLS9P27dv11FNPydvb2+n63bt317Fjx7Rv3z6nY/761786bdepU0eSsr1d9Gfnz5/X8OHDVaVKFbm5ucnNzU3e3t5KS0tz+h1Zs2aNmjdvrho1auR4rjVr1qhq1ap69NFHc+yzadMmlSxZMsvMVs+ePSUpy+3KRx55RKVLl3Zq27x5c47PTW61a9dOxYsXd2xfP1779u1TcnKyOnfu7HTcPffcoyZNmuT6OtnZtGmTatasqb/85S9O7T179pQx5qazaW3btlViYqJWrFihYcOGqVatWlq5cqX++te/Os1yfvHFF4qIiFC9evWc/l5bt26d5fZxlSpVNHfuXK1cuVKPP/64HnroIcctWtz5CDMo0oYOHarRo0erY8eO+vzzz7V9+3bFxcWpbt26+uOPPxz9Tp486fTCkOn6tsy1EU899ZTc3d2dfiZNmiRjjE6dOpVjPSdPnlRQUFCW9uzarvfwww9r5cqVunLlip5//nlVqFBBERERWrJkyU2PzeTl5SVfX99c979RrZlrFwrD6dOnZYzJdno/JCQk2+v7+/s7bWfe0vjz85ydbt26acaMGerbt6/WrVun7777TnFxcSpXrpzTsb/99pvTLbvs5KZP5u/A9euMAgIC5ObmluVxZTcGt/J7lOlm45VZR27+LvLq5MmTeXpus+Pp6amOHTtqypQpio2N1S+//KKaNWvq3//+t+Lj4yVd+3vds2dPlr9VHx8fGWP0+++/O52zXbt
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# age dirtibution group into male and female (1 = male; 0 = female)\n",
|
||
|
"# male\n",
|
||
|
"plt.title('age distribution according to Sex') \n",
|
||
|
"df[df[\"sex\"] == 1]['age'].plot.hist()\n",
|
||
|
"print(df[df[\"sex\"] > 0]['age'])\n",
|
||
|
"# female\n",
|
||
|
"df[df[\"sex\"] == 0]['age'].plot.hist()\n",
|
||
|
"plt.xlabel('age [years]')\n",
|
||
|
"plt.legend([\"male\", \"female\"])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"Text(0.5, 0, 'max heart rate')"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 10,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm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SkiKsra1Fs2bNpOXyWr+Tk5Pw8vLSqislJUXY29uLpk2bSm05f2Offvqp1jquX78uAGiNjxBC/PDDDwKAGDp0qNSW12s457W6fft2reU7deokPDw8pOlvvvlGABD79+/X6jdmzJgiPf8//vhjnn8/T548EWZmZqJTp05a7bGxsUKpVIoBAwYUuN6c11NAQIBW+5IlSwQAERcXJ63PyMgo199/SkqKcHR0FH369Ml3G5mZmSI1NVVYWFiIL7/8Mte283otL126VAAQ0dHRBdYvxP+9Dry9vbVeKzExMcLY2Fi4uLho9X/1vc3T01P06NGjwG2U9nvC+PHjhY2NTYHbHDNmjLC0tBT37t3Tav/8888FAPHHH38UuHx5wtNMMtOlSxet6Tp16kChUKBjx45Sm5GREWrWrJnrkO2PP/6I9957D5aWljAyMoKxsTHWr1+f61CzUqnE9u3bkZiYCG9vbwghsHXrVhgaGpa4RgDS//D/3f5qjcWhUCjQqVMnaTpnv9VqNRo2bCi129rawt7evsjb6ty5s9a+1q9fHwCk5W/fvo0///wTAwcOBABkZmZKj06dOiEuLg43btyQll+9ejW8vb1hamoqjfuRI0fyPMTfrVs3GBsbF2M
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.figure()\n",
|
||
|
"# Plot maximum heart rate\n",
|
||
|
"# Heart disease (0 = no, 1 = yes)\n",
|
||
|
"plt.title('maximum heart rate according to heart disease') \n",
|
||
|
"df[df[\"target\"] == 1]['thalach'].plot.hist()\n",
|
||
|
"# no disease\n",
|
||
|
"df[df[\"target\"] == 0]['thalach'].plot.hist()\n",
|
||
|
"plt.legend([\"disease\", \"no disease\"])\n",
|
||
|
"plt.xlabel('max heart rate')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"metadata": {
|
||
|
"scrolled": true
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<matplotlib.legend.Legend at 0x7f1559ba5520>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 11,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAHACAYAAACI8pP3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAA9hAAAPYQGoP6dpAABH70lEQVR4nO3dd3QU5f7H8c8mpFeIpGmoUqWDIlFMFAjSsYGAIFUwKAIiykUhKBKJgl5BxEaxAHotiPeCEgXpHUGaIBAglBgpJhBCAsnz+8OT/blpgAYySd6vc+Yc9plnZr4zs5P9MDM7azPGGAEAAFiIU3EXAAAAkBsBBQAAWA4BBQAAWA4BBQAAWA4BBQAAWA4BBQAAWA4BBQAAWA4BBQAAWA4BBQAAWA4BpZSYM2eObDabNm/enO/4jh07qkqVKte3qL9YvHixYmJirrh/3759ZbPZ7IOXl5eqVKmizp07a/bs2crIyMgzTWRkpCIjI4uu6BKmb9++efaxzWa7qu0uXf2+KmhZl3tP/h3Hjx9XTEyMtm3blmdcTEyMbDZbkS2rrMp9HB06dEg2m01z5sy57rUUtr//qcTEREVHR6tmzZry8PBQhQoVVL9+fQ0aNEiJiYlFvjxcvXLFXQDKhsWLF+utt966qg8+Dw8PLVu2TJKUnp6uxMRELVmyRIMGDdKUKVP07bff6qabbrL3nzFjRlGXXeKtW7fOYRtdib+zr/7usq7W8ePHNWHCBFWpUkWNGjVyGDdw4EDde++913T5ZVFISIjWrVun6tWrX/dlF7a//4mjR4+qSZMm8vf319NPP61atWopJSVFu3fv1meffaaDBw8qLCysyJaHv4eAgmvq/Pnz8vT0/FvTOjk56fbbb3do69Onj/r166eOHTvqwQcf1Pr16+3j6tat+49qLY1yb7+iZozRhQsX5OHhcc2XdTk33XTTNQ9IpUF6errc3d2v+GyTm5tbse/bovbee+/p5MmT2rhxo6pWrWpv79q1q/71r38pOzu7GKtDDi7xlGHGGM2YMUONGjWSh4eHypcvrwcffFAHDx506BcfH68uXbropptukru7u26++WYNHjxYJ0+edOiXc4p969atevDBB1W+fHlVr15dffv21VtvvSVJDpdtDh069LfqjoqK0qBBg7RhwwatXLnS3p7fJZ63335bDRs2lLe3t3x8fFS7dm3961//cuiTlJSkwYMH66abbpKrq6uqVq2qCRMm6NKlSw79JkyYoObNm6tChQry9fVVkyZN9MEHHyj3720uW7ZMkZGRCggIkIeHhypVqqQHHnhA58+ft/fJzMzUxIkTVbt2bbm5ualixYrq16+ffv/99yvaBnPmzFGtWrXk5uamOnXq6MMPP8y3X+7LLufPn9eoUaNUtWpVubu7q0KFCmrWrJnmz58vSZfdVzabTU888YRmzpypOnXqyM3NTXPnzs13WTnOnDmjfv36qUKFCvLy8lKnTp3yvMeqVKmivn375pn2r/v0xx9/1K233ipJ6tevn722nGXmd4knOztbcXFx9u0cGBioPn366OjRo3mWU69ePW3atEktW7aUp6enqlWrpldeeeWKPqzeeust3XXXXQoMDJSXl5fq16+vuLg4Xbx4MU/fb7/9Vq1atZKfn588PT1Vp04dxcbGOvTZsGGDOnXqpICAALm7u6t69eoaPny4Q5/Vq1erVatW8vHxkaenp8LDw/W///3PoU/OZbalS5eqf//+qlixojw9PZWRkSFjjOLi4lS5cmW5u7urSZMmWrJkSZ5687vEk7Otd+3apR49esjPz09BQUHq37+/UlJSHKb/448/NGDAAFWoUEHe3t7q0KGDDh48eNnLj5fb35K0aNEitWjRQp6envLx8VGbNm20bt26AueZ49SpU3JyclJgYGC+452cHD8aN2/erM6dO6tChQpyd3dX48aN9dlnn9nHnzx5UmFhYQoPD3fY57t375aXl5d69+592ZqQF2dQSpmsrKw8H6yS8nyIStLgwYM1Z84cDRs2TJMnT9bp06f14osvKjw8XNu3b1d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LMlClTHOaTmJhoPDw8zOjRo/NdTnZ2trl48aI5fPiwkWS+/vpr+7jx48cbSWbcuHF5phs6dKi5mrfbo48+ary8vAocv2fPHiPJPP744/a2iIgIExERYX/9xBNPGH9//0KXM3jwYOPt7W0OHz7s0P7aa68ZSWbXrl35TpeVlWUuXrxoXnzxRRMQEGCys7ONMcZ8/vnnRpLZtm1bgcucP3++kWS++OILh/ZNmzYZSWbGjBkFTpuVlWVCQ0NNkyZN7Ms0xphDhw4ZFxcXh31sjDGSzPjx4+2v69WrZ7p27Vrg/I0pfF9JMn5+fub06dP5jvvrsnLek/fdd59DvzVr1hhJZuLEifa2ypUrm0cffTTPPHPv05xtNHv27Dx9c95/OXLeI9HR0Q79NmzYYCSZf/3rXw7LkWQ2bNjg0Ldu3bqmbdu2eZZVmJz3xocffmicnZ3t2+rs2bPG19fX3HnnnQ77Lrfq1aub6tWrm/T09AL73H777SYwMNCcPXvW3nbp0iVTr149c9NNN9nnn7MP+vTp4zD9mTNnjLu7e4H75q/bPCEhIc82z9nWcXFxDtNHR0cbd3d3+/L/97//GUnm7bffdugXGxub5/2Sn4L2d85xUL9+fZOVlWVvP3v2rAkMDDTh4eGFzjc7O9sMHjzYODk5GUnGZrOZOnXqmBEjRpiEhASHvrVr1zaNGzc2Fy9edGjv2LGjCQkJcVj+5MmTjSTz1VdfmUcffdR4eHiYn3/+udBaUDAu8ZQyH374oTZt2pRnyP2/if/+97+y2Wx65JFHdOnSJfsQHByshg0b6scff7T3TU5O1pAhQxQWFqZy5crJxcVFlStXliTt2bMnTw0PPPDANV1HKf8zQrnddttt+uOPP9SjRw99/fXXeS5JSX9uh7vvvlu
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Plot sex and target in one histogramm via crosstab\n",
|
||
|
"pd.crosstab(df.sex,df.target).plot(kind=\"bar\",color=['red','blue' ])\n",
|
||
|
"plt.title('Heart Disease distribution according to Sex')\n",
|
||
|
"plt.xlabel('Sex (0 = Female, 1 = Male)')\n",
|
||
|
"plt.legend([\"no disease\", \"disease\"])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 12,
|
||
|
"metadata": {
|
||
|
"scrolled": true
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"Text(0, 0.5, 'Frequency of Disease or Not')"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 12,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABNYAAAIhCAYAAACCMjckAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAA9hAAAPYQGoP6dpAABg0klEQVR4nO3deZxO9f//8edl9p2xzJhmMBhbtiwJFcKUsZWiorIvIYSkfBOS3UT5WJIsRZbsFZnssu8lHyKMbbLvzDBzfn/0m+vjamaY67jGdeFxv92u2815n/c553Wd65ozzbP3OW+LYRiGAAAAAAAAANglm7MLAAAAAAAAAB5EBGsAAAAAAACACQRrAAAAAAAAgAkEawAAAAAAAIAJBGsAAAAAAACACQRrAAAAAAAAgAkEawAAAAAAAIAJBGsAAAAAAACACQRrAAAAAAAAgAkEawCA+2rKlCmyWCzaunVruuvr1aunAgUK3N+ibvPTTz+pX79+me7fokULWSwW68vPz08FChRQgwYNNHnyZCUmJqbZpnr16qpevbrjinZR/fr1szk3vr6+Cg8P1/PPP68vvvhCly9fTrNNixYt7P78T5w4oX79+mnnzp12bZfesSwWizp37mzXfu5m7NixmjJlSpr2w4cPy2KxpLvufurevbssFovq1avn1DruRep37XYFChRQixYtnFLH3V73+vP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KMPXv2pLtdcnKycfPmTWPAgAF
|
||
|
"text/plain": [
|
||
|
"<Figure size 1500x600 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Plot target and cp in one histogramm via crosstab\n",
|
||
|
"pd.crosstab(df.cp,df.target).plot(kind=\"bar\",figsize=(15,6),color=['#11A5AA','#AA1190' ])\n",
|
||
|
"plt.title('Heart Disease Distribution According To Chest Pain Type')\n",
|
||
|
"plt.xlabel('Chest Pain Type')\n",
|
||
|
"plt.xticks(rotation = 0)\n",
|
||
|
"plt.ylabel('Frequency of Disease or Not')\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 13,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<matplotlib.legend.Legend at 0x7f1559b95370>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 13,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAA9hAAAPYQGoP6dpAACZMklEQVR4nO3deVxU1fsH8M9l2EQ2QWFASUjNUgy1tNxXlFLEyHDJcivNNtc025AWTSuXtCiXNDX1V4aappj78pXCDdM0t3AHUVBQlMWZ8/tjmJGBmbnnwp2Zy/C8Xy++fZm53Hvmzh3n3HOe8zwCY4yBEEIIIcRBOdm7AYQQQggh1kSdHUIIIYQ4NOrsEEIIIcShUWeHEEIIIQ6NOjuEEEIIcWjU2SGEEEKIQ6PODiGEEEIcGnV2CCGEEOLQqLNDCCGE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zyeS8vLwC6kYerV69i165dhtEcAEYBwqVVJPDYHHd3dzz55JMAgFatWqFLly5o2rQpxo4di969e8PT0xO5ubnYuHEj4uPj8e677xr+trCwEDk5OVzH0V8n8+bNMwQVl2Wqc11WvXr1DO3l5e/vj4yMjHKPX7161ahthNgTdXYIkYFGo8GPP/6IBg0aYNGiReWe37hxI7766its3rwZvXv3RqdOnfDzzz9j8+bNeOaZZwzbrV692ujvGjdujEaNGuHo0aOYNm2axTZI/ZLipf/yd3NzMzzGGMPChQvLbZufn48XXngBoaGh2LlzJ959912
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# plot correlations for target\n",
|
||
|
"plt.figure()\n",
|
||
|
"plt.scatter(x=df.age[df.target==1], y=df.thalach[(df.target==1)], c=\"red\")\n",
|
||
|
"plt.scatter(x=df.age[df.target==0], y=df.thalach[(df.target==0)])\n",
|
||
|
"plt.title('Age-max Heart Rate Plot')\n",
|
||
|
"plt.xlabel('age[years]')\n",
|
||
|
"plt.ylabel('max. heart rate')\n",
|
||
|
"plt.legend([\"Disease\", \"No Disease\"])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 14,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<matplotlib.legend.Legend at 0x7f1559aaee80>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 14,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9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p16zBq1CjUqlULAQEBKCoqgsFgwIwZM9CsWTP4+voiIiICjz/+OM6cOaP4OzrCFPz8/fffNrcRaUv37t3x448/4u+//7YYLiOqahjsELmpa9euYfHixejQoQNiY2MxatQoFBYW4ttvv7XY7sqVK+jRowc2btyI6dOnY+nSpYiMjMTQoUOt9rlx40Z06tQJeXl5+Pjjj7Fy5Uq0bt0aQ4cOtQqKyrJu3TpoNBr0799f+Pe4ceMGBgwYgF69emHlypUYNWoUZs+ejenTp5u3uX79Onr06IGvvvoKL730En788UeMGDECM2bMQFJSkt39X716Fd26dcOXX36JF198EWvWrMHEiRPxxRdfYMCAAZBlGQCwY8cODB06FA0bNsSSJUvw448/4s0338TNmzcBAG3btsWCBQsAAK+//jp27NiBHTt24MknnyzXsRs1ahR8fHzw9ddfY9myZfDx8cGYMWMwceJEJCQkYNWqVXj77beRnp6Ojh074uLFi8LHVMmxY8cAALVq1bK5jUhbPvroI3Tq1AlRUVHm47Fjxw7V2knkNDIRuaWvvvpKBiB//PHHsizLcmFhoRwYGCh36dLFYrv//ve/MgB5zZo1Fo8/88wzMgB5wYIF5seaNWsmt2nTRr5x44bFtv369ZO1Wq2s1+vttqlZs2ZyVFSU8O/wxBNPyADkpUuXWjzet29fuWnTpubvP/744zK3mz59ugxAXrdunfmxevXqyU888YT5+2nTpsleXl7yrl27LH522bJlMgB59erVsizL8syZM2UAcl5ens327tq1y+qYmYgeuwULFsgA5Mcff9xiu8OHD8sA5LFjx1o8/uuvv8oA5FdffdX82BNPPCHXq1fPZjtLble9enX5xo0b8o0bN+QLFy7Ic+fOlSVJkjt06GDeLiUlRS75ce9IWx588EGhthC5M/bsELmp+fPnw9/fH48++igAIDAwEI888gi2bt1qMeNp8+bNCAoKQmJiosXPDxs2zOL7Y8eO4c8//8Rjjz0GALh586b5q2/fvtDpdDhy5IjVczdv3jT3jpSHJElWPUH33HOPxRDLhg0bUL16dashMNOsq59//tnm/n/44QfExsaidevWFm3u06cPJEnCpk2bAMA8RDVky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hwIfbt2+dwsPP444/jv//9L5544gmcPHkSLVu2xLZt2zB16lT07dsXvXv3tvmzycnJWL58Obp27Yrx48fjnnvugcFgwKlTp7Bu3Tq8/PLLuPfee/Hmm2/izJkz6NWrF+rUqYO8vDzMnTsXPj4+6NatGwCgUaNG8Pf3xzfffIO7774bgYGBiI6ORnR0dIWPXdOmTfH000/jP//5D7y8vMz1cN544w3UrVsX48ePd+iYVYQjbWnZsiXS0tKQmpqKdu3alasnicjlXJoeTURWBg0aJFerVk3Ozs62uc2jjz4qe3t7y1lZWbIsy/KpU6fkpKQkOTAwUA4KCpIffvhhefXq1TIAeeXKlRY/u2/fPnnIkCFyRESE7OPjI0dFRck9e/Y0z/oSkZWVJU+cOFFu0aKFHBAQIPv6+sqNGzeWn3nmGXn//v3m7UyzhUorPTtIlmU5JydHfvbZZ2WtVit7e3vL9erVkydNmiRfv37dYrvSs7FkWZYvX74sv/7663LTpk3latWqySEhIXLLli3l8ePHm4/RDz/8ID/wwANy7dq15WrVqskRERFy37595a1bt1rsa/HixXKzZs1kHx8fGYCckpL
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.figure()\n",
|
||
|
"plt.scatter(x=df.age[df.target==1], y=df.chol[(df.target==1)], c=\"red\")\n",
|
||
|
"plt.scatter(x=df.age[df.target==0], y=df.chol[(df.target==0)])\n",
|
||
|
"plt.title('Age-Cholesterol Plot')\n",
|
||
|
"plt.xlabel('age[years]')\n",
|
||
|
"plt.ylabel('Cholesterol')\n",
|
||
|
"plt.legend([\"Disease\", \"No Disease\"])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3 (ipykernel)",
|
||
|
"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.8.16"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 4
|
||
|
}
|