|
a |
|
b/.ipynb_checkpoints/smoking-checkpoint.ipynb |
|
|
1 |
{ |
|
|
2 |
"cells": [ |
|
|
3 |
{ |
|
|
4 |
"cell_type": "code", |
|
|
5 |
"execution_count": null, |
|
|
6 |
"id": "00b82428", |
|
|
7 |
"metadata": {}, |
|
|
8 |
"outputs": [], |
|
|
9 |
"source": [ |
|
|
10 |
"import pandas as pd\n", |
|
|
11 |
"import numpy as np\n", |
|
|
12 |
"import matplotlib.pyplot as plt\n", |
|
|
13 |
" cardio_data = pd.read_csv('cardio_train.csv', sep=';')\n", |
|
|
14 |
" print(cardio_data.head())\n", |
|
|
15 |
" smokers = cardio_data[cardio_data['smoke'] == 1]\n", |
|
|
16 |
" average_age = smokers['age'].mean()\n", |
|
|
17 |
" mode_age = smokers['age'].mode()[0]\n", |
|
|
18 |
" print('The average age of smokers ', average_age / 365)\n", |
|
|
19 |
" print('The most repeated age of smokers ', mode_age / 365)" |
|
|
20 |
] |
|
|
21 |
}, |
|
|
22 |
{ |
|
|
23 |
"cell_type": "code", |
|
|
24 |
"execution_count": null, |
|
|
25 |
"id": "cc7922cd", |
|
|
26 |
"metadata": {}, |
|
|
27 |
"outputs": [], |
|
|
28 |
"source": [ |
|
|
29 |
"cardio_data_2 = pd.read_csv('heart_data.csv')\n", |
|
|
30 |
"print(cardio_data_2.head())" |
|
|
31 |
] |
|
|
32 |
}, |
|
|
33 |
{ |
|
|
34 |
"cell_type": "code", |
|
|
35 |
"execution_count": null, |
|
|
36 |
"id": "9bb3ff25", |
|
|
37 |
"metadata": {}, |
|
|
38 |
"outputs": [], |
|
|
39 |
"source": [ |
|
|
40 |
"smokers = cardio_data_2[cardio_data_2['Smoking'] == 1]\n", |
|
|
41 |
"smokers['Heart']" |
|
|
42 |
] |
|
|
43 |
}, |
|
|
44 |
{ |
|
|
45 |
"cell_type": "code", |
|
|
46 |
"execution_count": null, |
|
|
47 |
"id": "7e85f38d", |
|
|
48 |
"metadata": {}, |
|
|
49 |
"outputs": [], |
|
|
50 |
"source": [ |
|
|
51 |
"nonsmokers = cardio_data_2[cardio_data_2]['Smoking'==0]" |
|
|
52 |
] |
|
|
53 |
}, |
|
|
54 |
{ |
|
|
55 |
"cell_type": "code", |
|
|
56 |
"execution_count": null, |
|
|
57 |
"id": "9f1517c9", |
|
|
58 |
"metadata": {}, |
|
|
59 |
"outputs": [], |
|
|
60 |
"source": [] |
|
|
61 |
} |
|
|
62 |
], |
|
|
63 |
"metadata": { |
|
|
64 |
"kernelspec": { |
|
|
65 |
"display_name": "Python 3 (ipykernel)", |
|
|
66 |
"language": "python", |
|
|
67 |
"name": "python3" |
|
|
68 |
}, |
|
|
69 |
"language_info": { |
|
|
70 |
"codemirror_mode": { |
|
|
71 |
"name": "ipython", |
|
|
72 |
"version": 3 |
|
|
73 |
}, |
|
|
74 |
"file_extension": ".py", |
|
|
75 |
"mimetype": "text/x-python", |
|
|
76 |
"name": "python", |
|
|
77 |
"nbconvert_exporter": "python", |
|
|
78 |
"pygments_lexer": "ipython3", |
|
|
79 |
"version": "3.10.7" |
|
|
80 |
} |
|
|
81 |
}, |
|
|
82 |
"nbformat": 4, |
|
|
83 |
"nbformat_minor": 5 |
|
|
84 |
} |