agabka/projekt.ipynb

983 lines
107 KiB
Plaintext
Raw Normal View History

2023-12-29 18:23:11 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 80,
"id": "7ce53ad1",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n"
]
},
{
"cell_type": "code",
"execution_count": 81,
"id": "73edef6d",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Patient Id</th>\n",
" <th>Age</th>\n",
" <th>Gender</th>\n",
" <th>Air Pollution</th>\n",
" <th>Alcohol use</th>\n",
" <th>Dust Allergy</th>\n",
" <th>OccuPational Hazards</th>\n",
" <th>Genetic Risk</th>\n",
" <th>chronic Lung Disease</th>\n",
" <th>Balanced Diet</th>\n",
" <th>...</th>\n",
" <th>Fatigue</th>\n",
" <th>Weight Loss</th>\n",
" <th>Shortness of Breath</th>\n",
" <th>Wheezing</th>\n",
" <th>Swallowing Difficulty</th>\n",
" <th>Clubbing of Finger Nails</th>\n",
" <th>Frequent Cold</th>\n",
" <th>Dry Cough</th>\n",
" <th>Snoring</th>\n",
" <th>Level</th>\n",
" </tr>\n",
" <tr>\n",
" <th>index</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>P1</td>\n",
" <td>33</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>4</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>...</td>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>Low</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>P10</td>\n",
" <td>17</td>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>5</td>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>...</td>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" <td>6</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>7</td>\n",
" <td>2</td>\n",
" <td>Medium</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>P100</td>\n",
" <td>35</td>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>6</td>\n",
" <td>5</td>\n",
" <td>5</td>\n",
" <td>4</td>\n",
" <td>6</td>\n",
" <td>...</td>\n",
" <td>8</td>\n",
" <td>7</td>\n",
" <td>9</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>2</td>\n",
" <td>High</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>P1000</td>\n",
" <td>37</td>\n",
" <td>1</td>\n",
" <td>7</td>\n",
" <td>7</td>\n",
" <td>7</td>\n",
" <td>7</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>7</td>\n",
" <td>...</td>\n",
" <td>4</td>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>5</td>\n",
" <td>High</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>P101</td>\n",
" <td>46</td>\n",
" <td>1</td>\n",
" <td>6</td>\n",
" <td>8</td>\n",
" <td>7</td>\n",
" <td>7</td>\n",
" <td>7</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>...</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>2</td>\n",
" <td>4</td>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>High</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 25 columns</p>\n",
"</div>"
],
"text/plain": [
" Patient Id Age Gender Air Pollution Alcohol use Dust Allergy \\\n",
"index \n",
"0 P1 33 1 2 4 5 \n",
"1 P10 17 1 3 1 5 \n",
"2 P100 35 1 4 5 6 \n",
"3 P1000 37 1 7 7 7 \n",
"4 P101 46 1 6 8 7 \n",
"\n",
" OccuPational Hazards Genetic Risk chronic Lung Disease \\\n",
"index \n",
"0 4 3 2 \n",
"1 3 4 2 \n",
"2 5 5 4 \n",
"3 7 6 7 \n",
"4 7 7 6 \n",
"\n",
" Balanced Diet ... Fatigue Weight Loss Shortness of Breath \\\n",
"index ... \n",
"0 2 ... 3 4 2 \n",
"1 2 ... 1 3 7 \n",
"2 6 ... 8 7 9 \n",
"3 7 ... 4 2 3 \n",
"4 7 ... 3 2 4 \n",
"\n",
" Wheezing Swallowing Difficulty Clubbing of Finger Nails \\\n",
"index \n",
"0 2 3 1 \n",
"1 8 6 2 \n",
"2 2 1 4 \n",
"3 1 4 5 \n",
"4 1 4 2 \n",
"\n",
" Frequent Cold Dry Cough Snoring Level \n",
"index \n",
"0 2 3 4 Low \n",
"1 1 7 2 Medium \n",
"2 6 7 2 High \n",
"3 6 7 5 High \n",
"4 4 2 3 High \n",
"\n",
"[5 rows x 25 columns]"
]
},
"execution_count": 81,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dane = pd.read_csv(r'C:\\Users\\HP\\Desktop\\podyplomówka\\cancer_patient_data_sets.csv', index_col = 0)\n",
"dane.head()"
]
},
{
"cell_type": "code",
"execution_count": 66,
"id": "1831fdd7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Index: 1000 entries, 0 to 999\n",
"Data columns (total 25 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 Patient Id 1000 non-null object\n",
" 1 Age 1000 non-null int64 \n",
" 2 Gender 1000 non-null int64 \n",
" 3 Air Pollution 1000 non-null int64 \n",
" 4 Alcohol use 1000 non-null int64 \n",
" 5 Dust Allergy 1000 non-null int64 \n",
" 6 OccuPational Hazards 1000 non-null int64 \n",
" 7 Genetic Risk 1000 non-null int64 \n",
" 8 chronic Lung Disease 1000 non-null int64 \n",
" 9 Balanced Diet 1000 non-null int64 \n",
" 10 Obesity 1000 non-null int64 \n",
" 11 Smoking 1000 non-null int64 \n",
" 12 Passive Smoker 1000 non-null int64 \n",
" 13 Chest Pain 1000 non-null int64 \n",
" 14 Coughing of Blood 1000 non-null int64 \n",
" 15 Fatigue 1000 non-null int64 \n",
" 16 Weight Loss 1000 non-null int64 \n",
" 17 Shortness of Breath 1000 non-null int64 \n",
" 18 Wheezing 1000 non-null int64 \n",
" 19 Swallowing Difficulty 1000 non-null int64 \n",
" 20 Clubbing of Finger Nails 1000 non-null int64 \n",
" 21 Frequent Cold 1000 non-null int64 \n",
" 22 Dry Cough 1000 non-null int64 \n",
" 23 Snoring 1000 non-null int64 \n",
" 24 Level 1000 non-null object\n",
"dtypes: int64(23), object(2)\n",
"memory usage: 203.1+ KB\n"
]
}
],
"source": [
"dane.info()"
]
},
{
"cell_type": "code",
"execution_count": 67,
"id": "af7da17c",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>count</th>\n",
" <th>mean</th>\n",
" <th>std</th>\n",
" <th>min</th>\n",
" <th>25%</th>\n",
" <th>50%</th>\n",
" <th>75%</th>\n",
" <th>max</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Age</th>\n",
" <td>1000.0</td>\n",
" <td>37.174</td>\n",
" <td>12.005493</td>\n",
" <td>14.0</td>\n",
" <td>27.75</td>\n",
" <td>36.0</td>\n",
" <td>45.0</td>\n",
" <td>73.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Gender</th>\n",
" <td>1000.0</td>\n",
" <td>1.402</td>\n",
" <td>0.490547</td>\n",
" <td>1.0</td>\n",
" <td>1.00</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Air Pollution</th>\n",
" <td>1000.0</td>\n",
" <td>3.840</td>\n",
" <td>2.030400</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>3.0</td>\n",
" <td>6.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Alcohol use</th>\n",
" <td>1000.0</td>\n",
" <td>4.563</td>\n",
" <td>2.620477</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>5.0</td>\n",
" <td>7.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Dust Allergy</th>\n",
" <td>1000.0</td>\n",
" <td>5.165</td>\n",
" <td>1.980833</td>\n",
" <td>1.0</td>\n",
" <td>4.00</td>\n",
" <td>6.0</td>\n",
" <td>7.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OccuPational Hazards</th>\n",
" <td>1000.0</td>\n",
" <td>4.840</td>\n",
" <td>2.107805</td>\n",
" <td>1.0</td>\n",
" <td>3.00</td>\n",
" <td>5.0</td>\n",
" <td>7.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Genetic Risk</th>\n",
" <td>1000.0</td>\n",
" <td>4.580</td>\n",
" <td>2.126999</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>5.0</td>\n",
" <td>7.0</td>\n",
" <td>7.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>chronic Lung Disease</th>\n",
" <td>1000.0</td>\n",
" <td>4.380</td>\n",
" <td>1.848518</td>\n",
" <td>1.0</td>\n",
" <td>3.00</td>\n",
" <td>4.0</td>\n",
" <td>6.0</td>\n",
" <td>7.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Balanced Diet</th>\n",
" <td>1000.0</td>\n",
" <td>4.491</td>\n",
" <td>2.135528</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>4.0</td>\n",
" <td>7.0</td>\n",
" <td>7.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Obesity</th>\n",
" <td>1000.0</td>\n",
" <td>4.465</td>\n",
" <td>2.124921</td>\n",
" <td>1.0</td>\n",
" <td>3.00</td>\n",
" <td>4.0</td>\n",
" <td>7.0</td>\n",
" <td>7.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Smoking</th>\n",
" <td>1000.0</td>\n",
" <td>3.948</td>\n",
" <td>2.495902</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>3.0</td>\n",
" <td>7.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Passive Smoker</th>\n",
" <td>1000.0</td>\n",
" <td>4.195</td>\n",
" <td>2.311778</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>4.0</td>\n",
" <td>7.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Chest Pain</th>\n",
" <td>1000.0</td>\n",
" <td>4.438</td>\n",
" <td>2.280209</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>4.0</td>\n",
" <td>7.0</td>\n",
" <td>9.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Coughing of Blood</th>\n",
" <td>1000.0</td>\n",
" <td>4.859</td>\n",
" <td>2.427965</td>\n",
" <td>1.0</td>\n",
" <td>3.00</td>\n",
" <td>4.0</td>\n",
" <td>7.0</td>\n",
" <td>9.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Fatigue</th>\n",
" <td>1000.0</td>\n",
" <td>3.856</td>\n",
" <td>2.244616</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>3.0</td>\n",
" <td>5.0</td>\n",
" <td>9.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Weight Loss</th>\n",
" <td>1000.0</td>\n",
" <td>3.855</td>\n",
" <td>2.206546</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>3.0</td>\n",
" <td>6.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Shortness of Breath</th>\n",
" <td>1000.0</td>\n",
" <td>4.240</td>\n",
" <td>2.285087</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>4.0</td>\n",
" <td>6.0</td>\n",
" <td>9.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Wheezing</th>\n",
" <td>1000.0</td>\n",
" <td>3.777</td>\n",
" <td>2.041921</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>4.0</td>\n",
" <td>5.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Swallowing Difficulty</th>\n",
" <td>1000.0</td>\n",
" <td>3.746</td>\n",
" <td>2.270383</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>4.0</td>\n",
" <td>5.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Clubbing of Finger Nails</th>\n",
" <td>1000.0</td>\n",
" <td>3.923</td>\n",
" <td>2.388048</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>4.0</td>\n",
" <td>5.0</td>\n",
" <td>9.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Frequent Cold</th>\n",
" <td>1000.0</td>\n",
" <td>3.536</td>\n",
" <td>1.832502</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>3.0</td>\n",
" <td>5.0</td>\n",
" <td>7.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Dry Cough</th>\n",
" <td>1000.0</td>\n",
" <td>3.853</td>\n",
" <td>2.039007</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>4.0</td>\n",
" <td>6.0</td>\n",
" <td>7.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Snoring</th>\n",
" <td>1000.0</td>\n",
" <td>2.926</td>\n",
" <td>1.474686</td>\n",
" <td>1.0</td>\n",
" <td>2.00</td>\n",
" <td>3.0</td>\n",
" <td>4.0</td>\n",
" <td>7.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" count mean std min 25% 50% 75% \\\n",
"Age 1000.0 37.174 12.005493 14.0 27.75 36.0 45.0 \n",
"Gender 1000.0 1.402 0.490547 1.0 1.00 1.0 2.0 \n",
"Air Pollution 1000.0 3.840 2.030400 1.0 2.00 3.0 6.0 \n",
"Alcohol use 1000.0 4.563 2.620477 1.0 2.00 5.0 7.0 \n",
"Dust Allergy 1000.0 5.165 1.980833 1.0 4.00 6.0 7.0 \n",
"OccuPational Hazards 1000.0 4.840 2.107805 1.0 3.00 5.0 7.0 \n",
"Genetic Risk 1000.0 4.580 2.126999 1.0 2.00 5.0 7.0 \n",
"chronic Lung Disease 1000.0 4.380 1.848518 1.0 3.00 4.0 6.0 \n",
"Balanced Diet 1000.0 4.491 2.135528 1.0 2.00 4.0 7.0 \n",
"Obesity 1000.0 4.465 2.124921 1.0 3.00 4.0 7.0 \n",
"Smoking 1000.0 3.948 2.495902 1.0 2.00 3.0 7.0 \n",
"Passive Smoker 1000.0 4.195 2.311778 1.0 2.00 4.0 7.0 \n",
"Chest Pain 1000.0 4.438 2.280209 1.0 2.00 4.0 7.0 \n",
"Coughing of Blood 1000.0 4.859 2.427965 1.0 3.00 4.0 7.0 \n",
"Fatigue 1000.0 3.856 2.244616 1.0 2.00 3.0 5.0 \n",
"Weight Loss 1000.0 3.855 2.206546 1.0 2.00 3.0 6.0 \n",
"Shortness of Breath 1000.0 4.240 2.285087 1.0 2.00 4.0 6.0 \n",
"Wheezing 1000.0 3.777 2.041921 1.0 2.00 4.0 5.0 \n",
"Swallowing Difficulty 1000.0 3.746 2.270383 1.0 2.00 4.0 5.0 \n",
"Clubbing of Finger Nails 1000.0 3.923 2.388048 1.0 2.00 4.0 5.0 \n",
"Frequent Cold 1000.0 3.536 1.832502 1.0 2.00 3.0 5.0 \n",
"Dry Cough 1000.0 3.853 2.039007 1.0 2.00 4.0 6.0 \n",
"Snoring 1000.0 2.926 1.474686 1.0 2.00 3.0 4.0 \n",
"\n",
" max \n",
"Age 73.0 \n",
"Gender 2.0 \n",
"Air Pollution 8.0 \n",
"Alcohol use 8.0 \n",
"Dust Allergy 8.0 \n",
"OccuPational Hazards 8.0 \n",
"Genetic Risk 7.0 \n",
"chronic Lung Disease 7.0 \n",
"Balanced Diet 7.0 \n",
"Obesity 7.0 \n",
"Smoking 8.0 \n",
"Passive Smoker 8.0 \n",
"Chest Pain 9.0 \n",
"Coughing of Blood 9.0 \n",
"Fatigue 9.0 \n",
"Weight Loss 8.0 \n",
"Shortness of Breath 9.0 \n",
"Wheezing 8.0 \n",
"Swallowing Difficulty 8.0 \n",
"Clubbing of Finger Nails 9.0 \n",
"Frequent Cold 7.0 \n",
"Dry Cough 7.0 \n",
"Snoring 7.0 "
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dane.describe().T"
]
},
{
"cell_type": "code",
"execution_count": 68,
"id": "a043ec73",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Index(['Patient Id', 'Age', 'Gender', 'Air Pollution', 'Alcohol use',\n",
" 'Dust Allergy', 'OccuPational Hazards', 'Genetic Risk',\n",
" 'chronic Lung Disease', 'Balanced Diet', 'Obesity', 'Smoking',\n",
" 'Passive Smoker', 'Chest Pain', 'Coughing of Blood', 'Fatigue',\n",
" 'Weight Loss', 'Shortness of Breath', 'Wheezing',\n",
" 'Swallowing Difficulty', 'Clubbing of Finger Nails', 'Frequent Cold',\n",
" 'Dry Cough', 'Snoring', 'Level'],\n",
" dtype='object')"
]
},
"execution_count": 68,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dane.columns"
]
},
{
"cell_type": "code",
"execution_count": 69,
"id": "e6cad188",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Gender\n",
"1 598\n",
"2 402\n",
"dtype: int64"
]
},
"execution_count": 69,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dane2 = dane.groupby('Gender').size()\n",
"dane2"
]
},
{
"cell_type": "code",
"execution_count": 70,
"id": "966e57b9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: xlabel='Gender'>"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGrCAYAAADqwWxuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXR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AAAA4xAoAADAOAQKAAAwDoECAACMQ6AAAADjECgAAMA4BAoAADAOgQIAAIxDoAAAAOMQKAAAwDgECgAAMA6BAgAAjEOgAAAA4xAoAADAOAQKAAAwzmkFysyZM+VwODR27Fh729GjR1VQUKDk5GS1a9dOeXl5qqysDHtcRUWFcnNz1bZtW6WkpGjChAk6fvz46SwFAAA0Iw0OlC1btuiJJ55Qjx49wraPGzdOr732ml544QWVlpbqwIEDuvnmm+3xuro65ebmqra2Vhs2bNDixYu1aNEiTZ48ueFHAQAAmpW4hjyopqZG+fn5euqppzR9+nR7eyAQ0NNPP60lS5aof//+kqSFCxeqW7du2rhxo7KysrRy5Urt3LlTq1evlsfjUc+ePfXwww9r4sSJmjp1quLj40/aXygUUigUsu8Hg8GGLBsAjNb5gWXRXgLOoo9n5kZ7CUZr0BmUgoIC5ebmKjs7O2x7eXm5jh07Fra9a9eu6tixo8rKyiRJZWVl6t69uzwejz0nJydHwWBQO3bsOOX+iouL5Xa77Vt6enpDlg0AAJqIiANl6dKleuedd1RcXHzSmN/vV3x8vBITE8O2ezwe+f1+e87/xsmJ8RNjp1JUVKRAIGDf9u/fH+myAQB
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"dane['Gender'].value_counts().plot(kind = 'bar')\n"
]
},
{
"cell_type": "code",
"execution_count": 71,
"id": "8d81604c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[Smoking\n",
" 1 181\n",
" 2 222\n",
" 3 172\n",
" 4 59\n",
" 5 10\n",
" 6 60\n",
" 7 207\n",
" 8 89\n",
" dtype: int64]"
]
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dane3 = [dane.groupby('Smoking').size()]\n",
"dane3 "
]
},
{
"cell_type": "code",
"execution_count": 72,
"id": "d85261ce",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: ylabel='count'>"
]
},
"execution_count": 72,
"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pKSgO1fi1gywcDeDMyfBmx+T3QSUkF9ROhOJ+MvWQae+roEf1m0JSAjz5YtW4aZM2eiqKgI3377LVwuFy666CK0t7ervm+t4izMetdcAcy/CqjdLjoJqWRV1m9xbel40TF07/ozsvH4lKGQJClg+6ytrUVycjKWLVuGc889N2D71RIeg+tZUznwxiSgqUx0ElLRJienk1HCgp+6XieBLJrm5q7BB/HxobMG0LF4ukyvWiqBNyezYELA8pYU0RGCxoKfyvDXT4oDcurM6/Xi3nvvxdlnn42hQ4eqvj+t4pGMHrXVdBVM417RSUhlsjkCRU1RomMElUAd0cycORPFxcUoLCxUbR96wCMZvWmvB968HKgvFZ2EAqAjdgA8Ml+mSlP7iObOO+/E4sWLsWTJEmRmhvaNtDyS0ZPORuDtK3iRP4RUhXE6GbWocUQjyzLuuusuLFq0CEuXLkXfvn0V2a6esWT0wt4CvD0NqNoiOgkF0E4uVKYqpYtm5syZWLhwIT799FNERUWhqqoKABATEwObzeb39vWIQ5j1wNEGvD0VqFgtOgkF2N8SnsTrB7JExwh6Sg1vPtHPz5s3DzfffLNf29YrHslonbMDWHg1CyZE/dCQJDpCSFjwUxnMRgMevTzfr+3wM/vxeEVRyzwu4N3rgP0rRCchATwRKdjXaRUdI2S8sXIfXi/kiE2lsWS07L9/BPYsEZ2CBGmOHig6Qsh5/Itt+GZrlegYQYUlo1WrXwHWzROdggQqN+WIjhByvDJwz7sbsbmiSXSUoMGS0aI9S4GvHhCdggQr9vCCvwidLg9ue3MtKho7REcJCiwZranfDbx/E9eDIaxsTRUdIWTVtjpw2xtr0e7g69B
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"dane['Smoking'].value_counts().plot(kind = 'pie')"
]
},
{
"cell_type": "code",
"execution_count": 73,
"id": "86122d04",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[Passive Smoker\n",
" 1 60\n",
" 2 284\n",
" 3 140\n",
" 4 161\n",
" 5 30\n",
" 6 30\n",
" 7 187\n",
" 8 108\n",
" dtype: int64]"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dane4 = [dane.groupby('Passive Smoker').size()]\n",
"dane4"
]
},
{
"cell_type": "code",
"execution_count": 74,
"id": "c78bbd4c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: ylabel='count'>"
]
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZkAAAGFCAYAAAAvsY4uAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAABH4ElEQVR4nO3dd3xUVd4G8OdOn2Rm0nslIQUSehEQERAFBRQLNlxdyxYX13Utq667lndF13ffdW27rKIiiqiggmVFFClK70gn1PRkMpmZTK/3/SPC0gLJzL1zZu78vp8PH2WS3PsASZ7ce849h+N5ngchhBAiAhnrAIQQQqSLSoYQQohoqGQIIYSIhkqGEEKIaKhkCCGEiIZKhhBCiGioZAghhIiGSoYQQohoqGQIIYSIhkqGEEKIaKhkCCGEiIZKhhBCiGioZAghhIiGSoYQQohoqGQIIYSIhkqGEEKIaKhkCCGEiIZKhhBCiGioZAghhIiGSoYQQohoqGQIIYSIhkqGEEKIaKhkCCGEiIZKhhBCiGioZAghhIiGSoYQQohoqGQIIYSIhkqGEEKIaKhkCCGEiIZKhhBCiGioZAghhIiGSoYQQohoqGQIIYSIhkqGEEKIaKhkCCGEiIZKhhBCiGioZAghhIiGSoYQQohoqGQIIYSIhkqGEEKIaKhkCCGEiIZKhhBCiGioZAghhIiGSoYQQohoqGQIIYSIRsE6ACHRrsPtQ2uHG0abF3aPH06vHw5PAE6vH05vAA6vH05PAC5fADwPyDhALuPAcRzkMkDGcSd/JajkSNIqkaRVwqBVwqBVnP57jZL1H5cQQVH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1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"dane['Passive Smoker'].value_counts().plot(kind = 'pie')"
]
},
{
"cell_type": "code",
"execution_count": 75,
"id": "6385071c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Smoking Gender\n",
"1 1 102\n",
" 2 79\n",
"2 1 102\n",
" 2 120\n",
"3 1 79\n",
" 2 93\n",
"4 1 49\n",
" 2 10\n",
"5 1 10\n",
"6 1 28\n",
" 2 32\n",
"7 1 167\n",
" 2 40\n",
"8 1 61\n",
" 2 28\n",
"dtype: int64"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dane.groupby(['Smoking','Gender']).size()"
]
},
{
"cell_type": "code",
"execution_count": 82,
"id": "af3dd196",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: xlabel='Smoking,Gender'>"
]
},
"execution_count": 82,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAHICAYAAABkoRGaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA18klEQVR4nO3df3zO9eL/8ec1Y5uxzYbNTputQ0xUEhoqP1bzo0LK4SDHEX1Oo9ARO4VDOeQ4JR3spPKjD+l0ThQOjvyasoaJ/Doik8XZiLaZ2mXZ6/vHvq5PV0aN67LX5nG/3d63ut7v9/V+P6/X9XZ5el/v67ocxhgjAAAAi/iUdwAAAIAfo6AAAADrUFAAAIB1KCgAAMA6FBQAAGAdCgoAALAOBQUAAFiHggIAAKzjW94BrkRxcbGOHz+umjVryuFwlHccAADwMxhjdObMGUVGRsrH5/LnSCpkQTl+/LiioqLKOwYAALgCWVlZuuGGGy67ToUsKDVr1pRU8gCDgoLKOQ0AAPg58vPzFRUV5fp7/HIqZEG58LZOU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+f9QkeAABQ+ZW5oGzfvl0dOnRw3R41apQkaeDAgfrjH/+oDz74QJJ02223ud1vw4YNat++vSRp0aJFGjZsmDp16iQfHx/16tVLM2fOvMKHAAAAKpsyF5T27dvrcl+d8nO+ViU0NFSLFy8u664BAMB1gt/iAQAA1qGgAAAA61BQAACAdSgoAADAOhQUAABgHQoKAACwDgUFAABYh4I
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"dane6 = dane.groupby(['Smoking','Gender'])\n",
"dane6[['Smoking', 'Gender']].value_counts().plot(kind = 'bar')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "15eebd5b",
"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.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}