2400 lines
414 KiB
Plaintext
2400 lines
414 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"# Лабораторная работа №1"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## 7. Основные возможности библиотеки Pandas"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"###\tЗагрузка и сохранение данных"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 3,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"import pandas as pd "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 4,
|
|||
|
"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>Pregnancies</th>\n",
|
|||
|
" <th>Glucose</th>\n",
|
|||
|
" <th>BloodPressure</th>\n",
|
|||
|
" <th>SkinThickness</th>\n",
|
|||
|
" <th>Insulin</th>\n",
|
|||
|
" <th>BMI</th>\n",
|
|||
|
" <th>DiabetesPedigreeFunction</th>\n",
|
|||
|
" <th>Age</th>\n",
|
|||
|
" <th>Outcome</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>148</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>33.6</td>\n",
|
|||
|
" <td>0.627</td>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>85</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>29</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>26.6</td>\n",
|
|||
|
" <td>0.351</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>8</td>\n",
|
|||
|
" <td>183</td>\n",
|
|||
|
" <td>64</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>23.3</td>\n",
|
|||
|
" <td>0.672</td>\n",
|
|||
|
" <td>32</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>89</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>94</td>\n",
|
|||
|
" <td>28.1</td>\n",
|
|||
|
" <td>0.167</td>\n",
|
|||
|
" <td>21</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>137</td>\n",
|
|||
|
" <td>40</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>168</td>\n",
|
|||
|
" <td>43.1</td>\n",
|
|||
|
" <td>2.288</td>\n",
|
|||
|
" <td>33</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n",
|
|||
|
"0 6 148 72 35 0 33.6 \n",
|
|||
|
"1 1 85 66 29 0 26.6 \n",
|
|||
|
"2 8 183 64 0 0 23.3 \n",
|
|||
|
"3 1 89 66 23 94 28.1 \n",
|
|||
|
"4 0 137 40 35 168 43.1 \n",
|
|||
|
"\n",
|
|||
|
" DiabetesPedigreeFunction Age Outcome \n",
|
|||
|
"0 0.627 50 1 \n",
|
|||
|
"1 0.351 31 0 \n",
|
|||
|
"2 0.672 32 1 \n",
|
|||
|
"3 0.167 21 0 \n",
|
|||
|
"4 2.288 33 1 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 4,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df = pd.read_csv(\"diabetes.csv\")\n",
|
|||
|
"\n",
|
|||
|
"df.head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 1,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"ename": "NameError",
|
|||
|
"evalue": "name 'df' is not defined",
|
|||
|
"output_type": "error",
|
|||
|
"traceback": [
|
|||
|
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
|||
|
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
|||
|
"Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mdf\u001b[49m\u001b[38;5;241m.\u001b[39mto_csv(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnew.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m, index\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n",
|
|||
|
"\u001b[1;31mNameError\u001b[0m: name 'df' is not defined"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.to_csv(\"new.csv\", index=False)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Получение сведений о датафрейме с данными"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 6,
|
|||
|
"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>Pregnancies</th>\n",
|
|||
|
" <th>Glucose</th>\n",
|
|||
|
" <th>BloodPressure</th>\n",
|
|||
|
" <th>SkinThickness</th>\n",
|
|||
|
" <th>Insulin</th>\n",
|
|||
|
" <th>BMI</th>\n",
|
|||
|
" <th>DiabetesPedigreeFunction</th>\n",
|
|||
|
" <th>Age</th>\n",
|
|||
|
" <th>Outcome</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>count</th>\n",
|
|||
|
" <td>768.000000</td>\n",
|
|||
|
" <td>768.000000</td>\n",
|
|||
|
" <td>768.000000</td>\n",
|
|||
|
" <td>768.000000</td>\n",
|
|||
|
" <td>768.000000</td>\n",
|
|||
|
" <td>768.000000</td>\n",
|
|||
|
" <td>768.000000</td>\n",
|
|||
|
" <td>768.000000</td>\n",
|
|||
|
" <td>768.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>mean</th>\n",
|
|||
|
" <td>3.845052</td>\n",
|
|||
|
" <td>120.894531</td>\n",
|
|||
|
" <td>69.105469</td>\n",
|
|||
|
" <td>20.536458</td>\n",
|
|||
|
" <td>79.799479</td>\n",
|
|||
|
" <td>31.992578</td>\n",
|
|||
|
" <td>0.471876</td>\n",
|
|||
|
" <td>33.240885</td>\n",
|
|||
|
" <td>0.348958</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>std</th>\n",
|
|||
|
" <td>3.369578</td>\n",
|
|||
|
" <td>31.972618</td>\n",
|
|||
|
" <td>19.355807</td>\n",
|
|||
|
" <td>15.952218</td>\n",
|
|||
|
" <td>115.244002</td>\n",
|
|||
|
" <td>7.884160</td>\n",
|
|||
|
" <td>0.331329</td>\n",
|
|||
|
" <td>11.760232</td>\n",
|
|||
|
" <td>0.476951</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>min</th>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>0.078000</td>\n",
|
|||
|
" <td>21.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>25%</th>\n",
|
|||
|
" <td>1.000000</td>\n",
|
|||
|
" <td>99.000000</td>\n",
|
|||
|
" <td>62.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>27.300000</td>\n",
|
|||
|
" <td>0.243750</td>\n",
|
|||
|
" <td>24.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>50%</th>\n",
|
|||
|
" <td>3.000000</td>\n",
|
|||
|
" <td>117.000000</td>\n",
|
|||
|
" <td>72.000000</td>\n",
|
|||
|
" <td>23.000000</td>\n",
|
|||
|
" <td>30.500000</td>\n",
|
|||
|
" <td>32.000000</td>\n",
|
|||
|
" <td>0.372500</td>\n",
|
|||
|
" <td>29.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>75%</th>\n",
|
|||
|
" <td>6.000000</td>\n",
|
|||
|
" <td>140.250000</td>\n",
|
|||
|
" <td>80.000000</td>\n",
|
|||
|
" <td>32.000000</td>\n",
|
|||
|
" <td>127.250000</td>\n",
|
|||
|
" <td>36.600000</td>\n",
|
|||
|
" <td>0.626250</td>\n",
|
|||
|
" <td>41.000000</td>\n",
|
|||
|
" <td>1.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>max</th>\n",
|
|||
|
" <td>17.000000</td>\n",
|
|||
|
" <td>199.000000</td>\n",
|
|||
|
" <td>122.000000</td>\n",
|
|||
|
" <td>99.000000</td>\n",
|
|||
|
" <td>846.000000</td>\n",
|
|||
|
" <td>67.100000</td>\n",
|
|||
|
" <td>2.420000</td>\n",
|
|||
|
" <td>81.000000</td>\n",
|
|||
|
" <td>1.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Pregnancies Glucose BloodPressure SkinThickness Insulin \\\n",
|
|||
|
"count 768.000000 768.000000 768.000000 768.000000 768.000000 \n",
|
|||
|
"mean 3.845052 120.894531 69.105469 20.536458 79.799479 \n",
|
|||
|
"std 3.369578 31.972618 19.355807 15.952218 115.244002 \n",
|
|||
|
"min 0.000000 0.000000 0.000000 0.000000 0.000000 \n",
|
|||
|
"25% 1.000000 99.000000 62.000000 0.000000 0.000000 \n",
|
|||
|
"50% 3.000000 117.000000 72.000000 23.000000 30.500000 \n",
|
|||
|
"75% 6.000000 140.250000 80.000000 32.000000 127.250000 \n",
|
|||
|
"max 17.000000 199.000000 122.000000 99.000000 846.000000 \n",
|
|||
|
"\n",
|
|||
|
" BMI DiabetesPedigreeFunction Age Outcome \n",
|
|||
|
"count 768.000000 768.000000 768.000000 768.000000 \n",
|
|||
|
"mean 31.992578 0.471876 33.240885 0.348958 \n",
|
|||
|
"std 7.884160 0.331329 11.760232 0.476951 \n",
|
|||
|
"min 0.000000 0.078000 21.000000 0.000000 \n",
|
|||
|
"25% 27.300000 0.243750 24.000000 0.000000 \n",
|
|||
|
"50% 32.000000 0.372500 29.000000 0.000000 \n",
|
|||
|
"75% 36.600000 0.626250 41.000000 1.000000 \n",
|
|||
|
"max 67.100000 2.420000 81.000000 1.000000 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 6,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.describe()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 7,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|||
|
"RangeIndex: 768 entries, 0 to 767\n",
|
|||
|
"Data columns (total 9 columns):\n",
|
|||
|
" # Column Non-Null Count Dtype \n",
|
|||
|
"--- ------ -------------- ----- \n",
|
|||
|
" 0 Pregnancies 768 non-null int64 \n",
|
|||
|
" 1 Glucose 768 non-null int64 \n",
|
|||
|
" 2 BloodPressure 768 non-null int64 \n",
|
|||
|
" 3 SkinThickness 768 non-null int64 \n",
|
|||
|
" 4 Insulin 768 non-null int64 \n",
|
|||
|
" 5 BMI 768 non-null float64\n",
|
|||
|
" 6 DiabetesPedigreeFunction 768 non-null float64\n",
|
|||
|
" 7 Age 768 non-null int64 \n",
|
|||
|
" 8 Outcome 768 non-null int64 \n",
|
|||
|
"dtypes: float64(2), int64(7)\n",
|
|||
|
"memory usage: 54.1 KB\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.info()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"###\tПолучение сведений о колонках датафрейма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 8,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"Index(['Pregnancies', 'Glucose', 'BloodPressure', 'SkinThickness', 'Insulin',\n",
|
|||
|
" 'BMI', 'DiabetesPedigreeFunction', 'Age', 'Outcome'],\n",
|
|||
|
" dtype='object')"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 8,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.columns"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"###\tВывод отельных строки и столбцов из датафрейма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 30,
|
|||
|
"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>Age</th>\n",
|
|||
|
" <th>Insulin</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>32</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>21</td>\n",
|
|||
|
" <td>94</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>33</td>\n",
|
|||
|
" <td>168</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>763</th>\n",
|
|||
|
" <td>63</td>\n",
|
|||
|
" <td>180</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>764</th>\n",
|
|||
|
" <td>27</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>765</th>\n",
|
|||
|
" <td>30</td>\n",
|
|||
|
" <td>112</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>766</th>\n",
|
|||
|
" <td>47</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>767</th>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>768 rows × 2 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Age Insulin\n",
|
|||
|
"0 50 0\n",
|
|||
|
"1 31 0\n",
|
|||
|
"2 32 0\n",
|
|||
|
"3 21 94\n",
|
|||
|
"4 33 168\n",
|
|||
|
".. ... ...\n",
|
|||
|
"763 63 180\n",
|
|||
|
"764 27 0\n",
|
|||
|
"765 30 112\n",
|
|||
|
"766 47 0\n",
|
|||
|
"767 23 0\n",
|
|||
|
"\n",
|
|||
|
"[768 rows x 2 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 30,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[[\"Age\", \"Insulin\"]]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 10,
|
|||
|
"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>Pregnancies</th>\n",
|
|||
|
" <th>Glucose</th>\n",
|
|||
|
" <th>BloodPressure</th>\n",
|
|||
|
" <th>SkinThickness</th>\n",
|
|||
|
" <th>Insulin</th>\n",
|
|||
|
" <th>BMI</th>\n",
|
|||
|
" <th>DiabetesPedigreeFunction</th>\n",
|
|||
|
" <th>Age</th>\n",
|
|||
|
" <th>Outcome</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>89</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>94</td>\n",
|
|||
|
" <td>28.1</td>\n",
|
|||
|
" <td>0.167</td>\n",
|
|||
|
" <td>21</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>137</td>\n",
|
|||
|
" <td>40</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>168</td>\n",
|
|||
|
" <td>43.1</td>\n",
|
|||
|
" <td>2.288</td>\n",
|
|||
|
" <td>33</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>116</td>\n",
|
|||
|
" <td>74</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>25.6</td>\n",
|
|||
|
" <td>0.201</td>\n",
|
|||
|
" <td>30</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n",
|
|||
|
"3 1 89 66 23 94 28.1 \n",
|
|||
|
"4 0 137 40 35 168 43.1 \n",
|
|||
|
"5 5 116 74 0 0 25.6 \n",
|
|||
|
"\n",
|
|||
|
" DiabetesPedigreeFunction Age Outcome \n",
|
|||
|
"3 0.167 21 0 \n",
|
|||
|
"4 2.288 33 1 \n",
|
|||
|
"5 0.201 30 0 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 10,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.iloc[3:6]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 11,
|
|||
|
"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>Pregnancies</th>\n",
|
|||
|
" <th>Glucose</th>\n",
|
|||
|
" <th>BloodPressure</th>\n",
|
|||
|
" <th>SkinThickness</th>\n",
|
|||
|
" <th>Insulin</th>\n",
|
|||
|
" <th>BMI</th>\n",
|
|||
|
" <th>DiabetesPedigreeFunction</th>\n",
|
|||
|
" <th>Age</th>\n",
|
|||
|
" <th>Outcome</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>137</td>\n",
|
|||
|
" <td>40</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>168</td>\n",
|
|||
|
" <td>43.1</td>\n",
|
|||
|
" <td>2.288</td>\n",
|
|||
|
" <td>33</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8</th>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>197</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>45</td>\n",
|
|||
|
" <td>543</td>\n",
|
|||
|
" <td>30.5</td>\n",
|
|||
|
" <td>0.158</td>\n",
|
|||
|
" <td>53</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>13</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>189</td>\n",
|
|||
|
" <td>60</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>846</td>\n",
|
|||
|
" <td>30.1</td>\n",
|
|||
|
" <td>0.398</td>\n",
|
|||
|
" <td>59</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>14</th>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>166</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>19</td>\n",
|
|||
|
" <td>175</td>\n",
|
|||
|
" <td>25.8</td>\n",
|
|||
|
" <td>0.587</td>\n",
|
|||
|
" <td>51</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>16</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>118</td>\n",
|
|||
|
" <td>84</td>\n",
|
|||
|
" <td>47</td>\n",
|
|||
|
" <td>230</td>\n",
|
|||
|
" <td>45.8</td>\n",
|
|||
|
" <td>0.551</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>748</th>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>187</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>22</td>\n",
|
|||
|
" <td>200</td>\n",
|
|||
|
" <td>36.4</td>\n",
|
|||
|
" <td>0.408</td>\n",
|
|||
|
" <td>36</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>753</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>181</td>\n",
|
|||
|
" <td>88</td>\n",
|
|||
|
" <td>44</td>\n",
|
|||
|
" <td>510</td>\n",
|
|||
|
" <td>43.3</td>\n",
|
|||
|
" <td>0.222</td>\n",
|
|||
|
" <td>26</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>755</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>128</td>\n",
|
|||
|
" <td>88</td>\n",
|
|||
|
" <td>39</td>\n",
|
|||
|
" <td>110</td>\n",
|
|||
|
" <td>36.5</td>\n",
|
|||
|
" <td>1.057</td>\n",
|
|||
|
" <td>37</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>763</th>\n",
|
|||
|
" <td>10</td>\n",
|
|||
|
" <td>101</td>\n",
|
|||
|
" <td>76</td>\n",
|
|||
|
" <td>48</td>\n",
|
|||
|
" <td>180</td>\n",
|
|||
|
" <td>32.9</td>\n",
|
|||
|
" <td>0.171</td>\n",
|
|||
|
" <td>63</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>765</th>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>121</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>112</td>\n",
|
|||
|
" <td>26.2</td>\n",
|
|||
|
" <td>0.245</td>\n",
|
|||
|
" <td>30</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>243 rows × 9 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n",
|
|||
|
"4 0 137 40 35 168 43.1 \n",
|
|||
|
"8 2 197 70 45 543 30.5 \n",
|
|||
|
"13 1 189 60 23 846 30.1 \n",
|
|||
|
"14 5 166 72 19 175 25.8 \n",
|
|||
|
"16 0 118 84 47 230 45.8 \n",
|
|||
|
".. ... ... ... ... ... ... \n",
|
|||
|
"748 3 187 70 22 200 36.4 \n",
|
|||
|
"753 0 181 88 44 510 43.3 \n",
|
|||
|
"755 1 128 88 39 110 36.5 \n",
|
|||
|
"763 10 101 76 48 180 32.9 \n",
|
|||
|
"765 5 121 72 23 112 26.2 \n",
|
|||
|
"\n",
|
|||
|
" DiabetesPedigreeFunction Age Outcome \n",
|
|||
|
"4 2.288 33 1 \n",
|
|||
|
"8 0.158 53 1 \n",
|
|||
|
"13 0.398 59 1 \n",
|
|||
|
"14 0.587 51 1 \n",
|
|||
|
"16 0.551 31 1 \n",
|
|||
|
".. ... ... ... \n",
|
|||
|
"748 0.408 36 1 \n",
|
|||
|
"753 0.222 26 1 \n",
|
|||
|
"755 1.057 37 1 \n",
|
|||
|
"763 0.171 63 0 \n",
|
|||
|
"765 0.245 30 0 \n",
|
|||
|
"\n",
|
|||
|
"[243 rows x 9 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 11,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[df['Insulin'] > 100]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"###\tГруппировка и агрегация данных в датафрейме"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 12,
|
|||
|
"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>Insulin</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Pregnancies</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>81.675676</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>98.674074</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>85.844660</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>87.453333</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>69.441176</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <td>57.298246</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>6</th>\n",
|
|||
|
" <td>63.580000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7</th>\n",
|
|||
|
" <td>84.466667</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8</th>\n",
|
|||
|
" <td>92.815789</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>9</th>\n",
|
|||
|
" <td>62.428571</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>10</th>\n",
|
|||
|
" <td>34.791667</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>11</th>\n",
|
|||
|
" <td>65.454545</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>12</th>\n",
|
|||
|
" <td>112.555556</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>13</th>\n",
|
|||
|
" <td>27.900000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>14</th>\n",
|
|||
|
" <td>92.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>15</th>\n",
|
|||
|
" <td>110.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>17</th>\n",
|
|||
|
" <td>114.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Insulin\n",
|
|||
|
"Pregnancies \n",
|
|||
|
"0 81.675676\n",
|
|||
|
"1 98.674074\n",
|
|||
|
"2 85.844660\n",
|
|||
|
"3 87.453333\n",
|
|||
|
"4 69.441176\n",
|
|||
|
"5 57.298246\n",
|
|||
|
"6 63.580000\n",
|
|||
|
"7 84.466667\n",
|
|||
|
"8 92.815789\n",
|
|||
|
"9 62.428571\n",
|
|||
|
"10 34.791667\n",
|
|||
|
"11 65.454545\n",
|
|||
|
"12 112.555556\n",
|
|||
|
"13 27.900000\n",
|
|||
|
"14 92.000000\n",
|
|||
|
"15 110.000000\n",
|
|||
|
"17 114.000000"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 12,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"group = df.groupby(['Pregnancies'])['Insulin'].mean()\n",
|
|||
|
"group.to_frame()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Сортировка данных в датафрейме"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 13,
|
|||
|
"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>Pregnancies</th>\n",
|
|||
|
" <th>Glucose</th>\n",
|
|||
|
" <th>BloodPressure</th>\n",
|
|||
|
" <th>SkinThickness</th>\n",
|
|||
|
" <th>Insulin</th>\n",
|
|||
|
" <th>BMI</th>\n",
|
|||
|
" <th>DiabetesPedigreeFunction</th>\n",
|
|||
|
" <th>Age</th>\n",
|
|||
|
" <th>Outcome</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>661</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>199</td>\n",
|
|||
|
" <td>76</td>\n",
|
|||
|
" <td>43</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>42.9</td>\n",
|
|||
|
" <td>1.394</td>\n",
|
|||
|
" <td>22</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>561</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>198</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>32</td>\n",
|
|||
|
" <td>274</td>\n",
|
|||
|
" <td>41.3</td>\n",
|
|||
|
" <td>0.502</td>\n",
|
|||
|
" <td>28</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>228</th>\n",
|
|||
|
" <td>4</td>\n",
|
|||
|
" <td>197</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>39</td>\n",
|
|||
|
" <td>744</td>\n",
|
|||
|
" <td>36.7</td>\n",
|
|||
|
" <td>2.329</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8</th>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>197</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>45</td>\n",
|
|||
|
" <td>543</td>\n",
|
|||
|
" <td>30.5</td>\n",
|
|||
|
" <td>0.158</td>\n",
|
|||
|
" <td>53</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>579</th>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>197</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>99</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>34.7</td>\n",
|
|||
|
" <td>0.575</td>\n",
|
|||
|
" <td>62</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>342</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>68</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>32.0</td>\n",
|
|||
|
" <td>0.389</td>\n",
|
|||
|
" <td>22</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>349</th>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>80</td>\n",
|
|||
|
" <td>32</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>41.0</td>\n",
|
|||
|
" <td>0.346</td>\n",
|
|||
|
" <td>37</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>502</th>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>68</td>\n",
|
|||
|
" <td>41</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>39.0</td>\n",
|
|||
|
" <td>0.727</td>\n",
|
|||
|
" <td>41</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>182</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>74</td>\n",
|
|||
|
" <td>20</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>27.7</td>\n",
|
|||
|
" <td>0.299</td>\n",
|
|||
|
" <td>21</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>75</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>48</td>\n",
|
|||
|
" <td>20</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>24.7</td>\n",
|
|||
|
" <td>0.140</td>\n",
|
|||
|
" <td>22</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>768 rows × 9 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n",
|
|||
|
"661 1 199 76 43 0 42.9 \n",
|
|||
|
"561 0 198 66 32 274 41.3 \n",
|
|||
|
"228 4 197 70 39 744 36.7 \n",
|
|||
|
"8 2 197 70 45 543 30.5 \n",
|
|||
|
"579 2 197 70 99 0 34.7 \n",
|
|||
|
".. ... ... ... ... ... ... \n",
|
|||
|
"342 1 0 68 35 0 32.0 \n",
|
|||
|
"349 5 0 80 32 0 41.0 \n",
|
|||
|
"502 6 0 68 41 0 39.0 \n",
|
|||
|
"182 1 0 74 20 23 27.7 \n",
|
|||
|
"75 1 0 48 20 0 24.7 \n",
|
|||
|
"\n",
|
|||
|
" DiabetesPedigreeFunction Age Outcome \n",
|
|||
|
"661 1.394 22 1 \n",
|
|||
|
"561 0.502 28 1 \n",
|
|||
|
"228 2.329 31 0 \n",
|
|||
|
"8 0.158 53 1 \n",
|
|||
|
"579 0.575 62 1 \n",
|
|||
|
".. ... ... ... \n",
|
|||
|
"342 0.389 22 0 \n",
|
|||
|
"349 0.346 37 1 \n",
|
|||
|
"502 0.727 41 1 \n",
|
|||
|
"182 0.299 21 0 \n",
|
|||
|
"75 0.140 22 0 \n",
|
|||
|
"\n",
|
|||
|
"[768 rows x 9 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 13,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sorted_df = df.sort_values(by='Glucose', ascending = False)\n",
|
|||
|
"sorted_df"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"###\tУдаление строк/столбцов"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 14,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df_dropped_columns = df.drop(columns=['Insulin', 'BMI']) # Удаление столбцов 'Insulin' и 'BMI'"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 15,
|
|||
|
"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>Pregnancies</th>\n",
|
|||
|
" <th>Glucose</th>\n",
|
|||
|
" <th>BloodPressure</th>\n",
|
|||
|
" <th>SkinThickness</th>\n",
|
|||
|
" <th>DiabetesPedigreeFunction</th>\n",
|
|||
|
" <th>Age</th>\n",
|
|||
|
" <th>Outcome</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>148</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>0.627</td>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>85</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>29</td>\n",
|
|||
|
" <td>0.351</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>8</td>\n",
|
|||
|
" <td>183</td>\n",
|
|||
|
" <td>64</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0.672</td>\n",
|
|||
|
" <td>32</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>89</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>0.167</td>\n",
|
|||
|
" <td>21</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>137</td>\n",
|
|||
|
" <td>40</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>2.288</td>\n",
|
|||
|
" <td>33</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>763</th>\n",
|
|||
|
" <td>10</td>\n",
|
|||
|
" <td>101</td>\n",
|
|||
|
" <td>76</td>\n",
|
|||
|
" <td>48</td>\n",
|
|||
|
" <td>0.171</td>\n",
|
|||
|
" <td>63</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>764</th>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>122</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>27</td>\n",
|
|||
|
" <td>0.340</td>\n",
|
|||
|
" <td>27</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>765</th>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>121</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>0.245</td>\n",
|
|||
|
" <td>30</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>766</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>126</td>\n",
|
|||
|
" <td>60</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0.349</td>\n",
|
|||
|
" <td>47</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>767</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>93</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0.315</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>768 rows × 7 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Pregnancies Glucose BloodPressure SkinThickness \\\n",
|
|||
|
"0 6 148 72 35 \n",
|
|||
|
"1 1 85 66 29 \n",
|
|||
|
"2 8 183 64 0 \n",
|
|||
|
"3 1 89 66 23 \n",
|
|||
|
"4 0 137 40 35 \n",
|
|||
|
".. ... ... ... ... \n",
|
|||
|
"763 10 101 76 48 \n",
|
|||
|
"764 2 122 70 27 \n",
|
|||
|
"765 5 121 72 23 \n",
|
|||
|
"766 1 126 60 0 \n",
|
|||
|
"767 1 93 70 31 \n",
|
|||
|
"\n",
|
|||
|
" DiabetesPedigreeFunction Age Outcome \n",
|
|||
|
"0 0.627 50 1 \n",
|
|||
|
"1 0.351 31 0 \n",
|
|||
|
"2 0.672 32 1 \n",
|
|||
|
"3 0.167 21 0 \n",
|
|||
|
"4 2.288 33 1 \n",
|
|||
|
".. ... ... ... \n",
|
|||
|
"763 0.171 63 0 \n",
|
|||
|
"764 0.340 27 0 \n",
|
|||
|
"765 0.245 30 0 \n",
|
|||
|
"766 0.349 47 1 \n",
|
|||
|
"767 0.315 23 0 \n",
|
|||
|
"\n",
|
|||
|
"[768 rows x 7 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 15,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df_dropped_columns"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 16,
|
|||
|
"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>Pregnancies</th>\n",
|
|||
|
" <th>Glucose</th>\n",
|
|||
|
" <th>BloodPressure</th>\n",
|
|||
|
" <th>SkinThickness</th>\n",
|
|||
|
" <th>Insulin</th>\n",
|
|||
|
" <th>BMI</th>\n",
|
|||
|
" <th>DiabetesPedigreeFunction</th>\n",
|
|||
|
" <th>Age</th>\n",
|
|||
|
" <th>Outcome</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>8</td>\n",
|
|||
|
" <td>183</td>\n",
|
|||
|
" <td>64</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>23.3</td>\n",
|
|||
|
" <td>0.672</td>\n",
|
|||
|
" <td>32</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>89</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>94</td>\n",
|
|||
|
" <td>28.1</td>\n",
|
|||
|
" <td>0.167</td>\n",
|
|||
|
" <td>21</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>137</td>\n",
|
|||
|
" <td>40</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>168</td>\n",
|
|||
|
" <td>43.1</td>\n",
|
|||
|
" <td>2.288</td>\n",
|
|||
|
" <td>33</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>116</td>\n",
|
|||
|
" <td>74</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>25.6</td>\n",
|
|||
|
" <td>0.201</td>\n",
|
|||
|
" <td>30</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>6</th>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>78</td>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>32</td>\n",
|
|||
|
" <td>88</td>\n",
|
|||
|
" <td>31.0</td>\n",
|
|||
|
" <td>0.248</td>\n",
|
|||
|
" <td>26</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>763</th>\n",
|
|||
|
" <td>10</td>\n",
|
|||
|
" <td>101</td>\n",
|
|||
|
" <td>76</td>\n",
|
|||
|
" <td>48</td>\n",
|
|||
|
" <td>180</td>\n",
|
|||
|
" <td>32.9</td>\n",
|
|||
|
" <td>0.171</td>\n",
|
|||
|
" <td>63</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>764</th>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>122</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>27</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>36.8</td>\n",
|
|||
|
" <td>0.340</td>\n",
|
|||
|
" <td>27</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>765</th>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>121</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>112</td>\n",
|
|||
|
" <td>26.2</td>\n",
|
|||
|
" <td>0.245</td>\n",
|
|||
|
" <td>30</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>766</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>126</td>\n",
|
|||
|
" <td>60</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>30.1</td>\n",
|
|||
|
" <td>0.349</td>\n",
|
|||
|
" <td>47</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>767</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>93</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>30.4</td>\n",
|
|||
|
" <td>0.315</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>766 rows × 9 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n",
|
|||
|
"2 8 183 64 0 0 23.3 \n",
|
|||
|
"3 1 89 66 23 94 28.1 \n",
|
|||
|
"4 0 137 40 35 168 43.1 \n",
|
|||
|
"5 5 116 74 0 0 25.6 \n",
|
|||
|
"6 3 78 50 32 88 31.0 \n",
|
|||
|
".. ... ... ... ... ... ... \n",
|
|||
|
"763 10 101 76 48 180 32.9 \n",
|
|||
|
"764 2 122 70 27 0 36.8 \n",
|
|||
|
"765 5 121 72 23 112 26.2 \n",
|
|||
|
"766 1 126 60 0 0 30.1 \n",
|
|||
|
"767 1 93 70 31 0 30.4 \n",
|
|||
|
"\n",
|
|||
|
" DiabetesPedigreeFunction Age Outcome \n",
|
|||
|
"2 0.672 32 1 \n",
|
|||
|
"3 0.167 21 0 \n",
|
|||
|
"4 2.288 33 1 \n",
|
|||
|
"5 0.201 30 0 \n",
|
|||
|
"6 0.248 26 1 \n",
|
|||
|
".. ... ... ... \n",
|
|||
|
"763 0.171 63 0 \n",
|
|||
|
"764 0.340 27 0 \n",
|
|||
|
"765 0.245 30 0 \n",
|
|||
|
"766 0.349 47 1 \n",
|
|||
|
"767 0.315 23 0 \n",
|
|||
|
"\n",
|
|||
|
"[766 rows x 9 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 16,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df_dropped_rows = df.drop([0, 1]) # Удаление строк с индексами 0 и 1\n",
|
|||
|
"df_dropped_rows"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"###\tСоздание новых столбцов на основе данных из существующих столбцов датафрейма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 17,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df['Glucose-BP'] = df['Glucose'] - df['BloodPressure']\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 18,
|
|||
|
"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>Pregnancies</th>\n",
|
|||
|
" <th>Glucose</th>\n",
|
|||
|
" <th>BloodPressure</th>\n",
|
|||
|
" <th>SkinThickness</th>\n",
|
|||
|
" <th>Insulin</th>\n",
|
|||
|
" <th>BMI</th>\n",
|
|||
|
" <th>DiabetesPedigreeFunction</th>\n",
|
|||
|
" <th>Age</th>\n",
|
|||
|
" <th>Outcome</th>\n",
|
|||
|
" <th>Glucose-BP</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>148</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>33.6</td>\n",
|
|||
|
" <td>0.627</td>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>76</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>85</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>29</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>26.6</td>\n",
|
|||
|
" <td>0.351</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>19</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>8</td>\n",
|
|||
|
" <td>183</td>\n",
|
|||
|
" <td>64</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>23.3</td>\n",
|
|||
|
" <td>0.672</td>\n",
|
|||
|
" <td>32</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>119</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>89</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>94</td>\n",
|
|||
|
" <td>28.1</td>\n",
|
|||
|
" <td>0.167</td>\n",
|
|||
|
" <td>21</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>137</td>\n",
|
|||
|
" <td>40</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>168</td>\n",
|
|||
|
" <td>43.1</td>\n",
|
|||
|
" <td>2.288</td>\n",
|
|||
|
" <td>33</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>97</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>763</th>\n",
|
|||
|
" <td>10</td>\n",
|
|||
|
" <td>101</td>\n",
|
|||
|
" <td>76</td>\n",
|
|||
|
" <td>48</td>\n",
|
|||
|
" <td>180</td>\n",
|
|||
|
" <td>32.9</td>\n",
|
|||
|
" <td>0.171</td>\n",
|
|||
|
" <td>63</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>25</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>764</th>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>122</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>27</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>36.8</td>\n",
|
|||
|
" <td>0.340</td>\n",
|
|||
|
" <td>27</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>52</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>765</th>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>121</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>112</td>\n",
|
|||
|
" <td>26.2</td>\n",
|
|||
|
" <td>0.245</td>\n",
|
|||
|
" <td>30</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>49</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>766</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>126</td>\n",
|
|||
|
" <td>60</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>30.1</td>\n",
|
|||
|
" <td>0.349</td>\n",
|
|||
|
" <td>47</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>767</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>93</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>30.4</td>\n",
|
|||
|
" <td>0.315</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>768 rows × 10 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n",
|
|||
|
"0 6 148 72 35 0 33.6 \n",
|
|||
|
"1 1 85 66 29 0 26.6 \n",
|
|||
|
"2 8 183 64 0 0 23.3 \n",
|
|||
|
"3 1 89 66 23 94 28.1 \n",
|
|||
|
"4 0 137 40 35 168 43.1 \n",
|
|||
|
".. ... ... ... ... ... ... \n",
|
|||
|
"763 10 101 76 48 180 32.9 \n",
|
|||
|
"764 2 122 70 27 0 36.8 \n",
|
|||
|
"765 5 121 72 23 112 26.2 \n",
|
|||
|
"766 1 126 60 0 0 30.1 \n",
|
|||
|
"767 1 93 70 31 0 30.4 \n",
|
|||
|
"\n",
|
|||
|
" DiabetesPedigreeFunction Age Outcome Glucose-BP \n",
|
|||
|
"0 0.627 50 1 76 \n",
|
|||
|
"1 0.351 31 0 19 \n",
|
|||
|
"2 0.672 32 1 119 \n",
|
|||
|
"3 0.167 21 0 23 \n",
|
|||
|
"4 2.288 33 1 97 \n",
|
|||
|
".. ... ... ... ... \n",
|
|||
|
"763 0.171 63 0 25 \n",
|
|||
|
"764 0.340 27 0 52 \n",
|
|||
|
"765 0.245 30 0 49 \n",
|
|||
|
"766 0.349 47 1 66 \n",
|
|||
|
"767 0.315 23 0 23 \n",
|
|||
|
"\n",
|
|||
|
"[768 rows x 10 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 18,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"###\tУдаление строк с пустыми значениями"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 19,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Pregnancies 0\n",
|
|||
|
"Glucose 0\n",
|
|||
|
"BloodPressure 0\n",
|
|||
|
"SkinThickness 0\n",
|
|||
|
"Insulin 0\n",
|
|||
|
"BMI 0\n",
|
|||
|
"DiabetesPedigreeFunction 0\n",
|
|||
|
"Age 0\n",
|
|||
|
"Outcome 0\n",
|
|||
|
"Glucose-BP 0\n",
|
|||
|
"dtype: int64\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"print(df.isna().sum())"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 20,
|
|||
|
"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>Pregnancies</th>\n",
|
|||
|
" <th>Glucose</th>\n",
|
|||
|
" <th>BloodPressure</th>\n",
|
|||
|
" <th>SkinThickness</th>\n",
|
|||
|
" <th>Insulin</th>\n",
|
|||
|
" <th>BMI</th>\n",
|
|||
|
" <th>DiabetesPedigreeFunction</th>\n",
|
|||
|
" <th>Age</th>\n",
|
|||
|
" <th>Outcome</th>\n",
|
|||
|
" <th>Glucose-BP</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>148</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>33.6</td>\n",
|
|||
|
" <td>0.627</td>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>76</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>85</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>29</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>26.6</td>\n",
|
|||
|
" <td>0.351</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>19</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>8</td>\n",
|
|||
|
" <td>183</td>\n",
|
|||
|
" <td>64</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>23.3</td>\n",
|
|||
|
" <td>0.672</td>\n",
|
|||
|
" <td>32</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>119</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>89</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>94</td>\n",
|
|||
|
" <td>28.1</td>\n",
|
|||
|
" <td>0.167</td>\n",
|
|||
|
" <td>21</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>137</td>\n",
|
|||
|
" <td>40</td>\n",
|
|||
|
" <td>35</td>\n",
|
|||
|
" <td>168</td>\n",
|
|||
|
" <td>43.1</td>\n",
|
|||
|
" <td>2.288</td>\n",
|
|||
|
" <td>33</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>97</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>763</th>\n",
|
|||
|
" <td>10</td>\n",
|
|||
|
" <td>101</td>\n",
|
|||
|
" <td>76</td>\n",
|
|||
|
" <td>48</td>\n",
|
|||
|
" <td>180</td>\n",
|
|||
|
" <td>32.9</td>\n",
|
|||
|
" <td>0.171</td>\n",
|
|||
|
" <td>63</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>25</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>764</th>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>122</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>27</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>36.8</td>\n",
|
|||
|
" <td>0.340</td>\n",
|
|||
|
" <td>27</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>52</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>765</th>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>121</td>\n",
|
|||
|
" <td>72</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>112</td>\n",
|
|||
|
" <td>26.2</td>\n",
|
|||
|
" <td>0.245</td>\n",
|
|||
|
" <td>30</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>49</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>766</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>126</td>\n",
|
|||
|
" <td>60</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>30.1</td>\n",
|
|||
|
" <td>0.349</td>\n",
|
|||
|
" <td>47</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>66</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>767</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>93</td>\n",
|
|||
|
" <td>70</td>\n",
|
|||
|
" <td>31</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>30.4</td>\n",
|
|||
|
" <td>0.315</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>23</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>768 rows × 10 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n",
|
|||
|
"0 6 148 72 35 0 33.6 \n",
|
|||
|
"1 1 85 66 29 0 26.6 \n",
|
|||
|
"2 8 183 64 0 0 23.3 \n",
|
|||
|
"3 1 89 66 23 94 28.1 \n",
|
|||
|
"4 0 137 40 35 168 43.1 \n",
|
|||
|
".. ... ... ... ... ... ... \n",
|
|||
|
"763 10 101 76 48 180 32.9 \n",
|
|||
|
"764 2 122 70 27 0 36.8 \n",
|
|||
|
"765 5 121 72 23 112 26.2 \n",
|
|||
|
"766 1 126 60 0 0 30.1 \n",
|
|||
|
"767 1 93 70 31 0 30.4 \n",
|
|||
|
"\n",
|
|||
|
" DiabetesPedigreeFunction Age Outcome Glucose-BP \n",
|
|||
|
"0 0.627 50 1 76 \n",
|
|||
|
"1 0.351 31 0 19 \n",
|
|||
|
"2 0.672 32 1 119 \n",
|
|||
|
"3 0.167 21 0 23 \n",
|
|||
|
"4 2.288 33 1 97 \n",
|
|||
|
".. ... ... ... ... \n",
|
|||
|
"763 0.171 63 0 25 \n",
|
|||
|
"764 0.340 27 0 52 \n",
|
|||
|
"765 0.245 30 0 49 \n",
|
|||
|
"766 0.349 47 1 66 \n",
|
|||
|
"767 0.315 23 0 23 \n",
|
|||
|
"\n",
|
|||
|
"[768 rows x 10 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 20,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.dropna() #Тк.пустых строк нет, мы ничего не удалили"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"###\tЗаполнение пустых значений на основе существующих данных"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 21,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df.fillna(df.mean(), inplace=True)\n",
|
|||
|
"df.fillna(df.median(), inplace=True)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Мы обрабатываем пустые значения для каждого столбца отдельно\n",
|
|||
|
"\n",
|
|||
|
"Мы можем заполнить пропуски средним или медианой, если это числовой столбец\n",
|
|||
|
"\n",
|
|||
|
"Мы заполняем средним, если в колонке нет выбросов\n",
|
|||
|
"\n",
|
|||
|
"Если столбец категориальный, то мы можем заполнить пропуски модой (самым часто встречающимся значением)\n",
|
|||
|
"\n",
|
|||
|
"Если пропусков мало, то их можно просто удалить."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## 8. Возможности визуализации"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 22,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"import matplotlib.pyplot as plt"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 31,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0cAAAHDCAYAAADvBGFkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOx9eZwdRbn20+fMkj0QIOw7CILAFVREFoOigIobXj8Vr4obKm5wFS/3ioLojcp1QxF3cQFBFEFBdgIICUuAAGEJSUjIviczmSSznNP9/dGnut+qemvpc87MnJnU8/tB5nRXV1VX1/Lub5QkSYKAgICAgICAgICAgIDtHKXh7kBAQEBAQEBAQEBAQEArIDBHAQEBAQEBAQEBAQEBCMxRQEBAQEBAQEBAQEAAgMAcBQQEBAQEBAQEBAQEAAjMUUBAQEBAQEBAQEBAAIDAHAUEBAQEBAQEBAQEBAAIzFFAQEBAQEBAQEBAQACAwBwFBAQEBAQEBAQEBAQACMxRQEBAQEBAQEBAQEAAgMAcBQQEBIw4LF68GFEU4aqrrhrurhhx1VVXIYoiLF68eEja6+npwdSpU3H11Vc3VM9HPvIR7Lfffs3pVIvgtttuw4QJE7B27drh7kpAQEBAyyMwRwEBAQEtBMFUzJ49e7i7wuLiiy9GFEXZf+PGjcNhhx2Gr371q+ju7m5KG9dccw1++MMfFnrmRz/6ESZOnIj3ve992r2nnnoKZ599Nvbff3+MGTMGEyZMwL/927/hggsuwIsvvtiUPrcyTjvtNBx00EGYPn36cHclICAgoOXRNtwdCAgICAgohn333Rfbtm1De3v7sPXhyiuvxIQJE9DT04M77rgD3/rWt3DPPffgwQcfRBRFDdV9zTXXYO7cufjiF7/oVX5gYAA/+tGPcN5556FcLkv3fvnLX+LTn/40dt55Z5x11lk49NBDUalUMHfuXPz+97/HD3/4Q2zbtk17brThnHPOwZe+9CVccsklmDhx4nB3JyAgIKBlEZijgICAgBGGKIowZsyYYe3De97zHuy8884AgE996lM488wzccMNN+Chhx7CcccdN6R9ufnmm7F27Vq8973vla7PnDkTn/70p3H88cfj5ptv1piC733ve/jWt741lF0dNpx55pn43Oc+h+uvvx4f/ehHh7s7AQEBAS2LYFYXEBAQMMLA+Rx95CMfwYQJE7B8+XK8853vxIQJE7DLLrvgS1/6EqrVqvR8HMf44Q9/iMMPPxxjxozBrrvuinPOOQcbN26su09veMMbAACLFi2ylvvpT3+Kww8/HJ2dndhjjz1w7rnnYtOmTdn9adOm4ZZbbsFLL72Ume65fIBuvPFG7LfffjjwwAOl65dccgmiKMLVV1/NakvGjBmDSy+91Ko1uvfeexFFEe69917pusnv6/nnn8d73/te7LLLLhg7diwOOeQQ/M///I9U5oknnsDpp5+OSZMmYcKECXjjG9+Ihx56SCozMDCASy65BAcffDDGjBmDnXbaCSeccALuvPNOrb33vOc9mDJlCsaMGYNXvepV+Pvf/669x9SpU3HkkUfipptuMr5rQEBAQEDQHAUEBASMGlSrVZx66qk49thj8X//93+466678L3vfQ8HHnggPv3pT2flzjnnHFx11VU4++yz8fnPfx6LFi3CT37yEzzxxBN48MEH6zLXW7hwIQBgp512Mpa5+OKLcckll+CUU07Bpz/9acybNw9XXnklHn300azd//mf/0FXVxeWLVuGH/zgBwCACRMmWNueOXMmjj76aOna1q1bcc8992DatGnYa6+9Cr9PPXjqqadw4oknor29HZ/85Cex3377YeHChfjHP/6RaaieeeYZnHjiiZg0aRIuuOACtLe34+c//zmmTZuG++67D8ceeyyAdKymT5+Oj3/843jNa16D7u5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GBAQEDCaEZijgICAgFECn3DUcRxbk6WqzJUJJ510UhatbjgxZcoURFGkBZM46KCD0NbWhrlz52rPvP71rwcAtLW5j0ATI6EGuWg2TjrpJCxcuBA33XQT7rjjDvzqV7/CD37wA/zsZz/Dxz/+8cws8Etf+hJOPfVUto6DDjpI+i3GqBW+W0BAQECrIjBHAQEBAdsRDjzwQNx11104/vjjMXbs2CFrd9999wUAzJs3TzIp6+/vx6JFi3DKKadk14poNtra2nDggQdqUfLGjx+fBTlYvny5pEEpAmGKRiPqAdA0XeKdOGZMYJdddsG4ceMwb9487d7zzz+PUqmEvffeO7s2ZcoUnH322Tj77LPR09ODk046CRdffDE+/vGPZ+21t7dLY2fDokWLsPPOO3szwAEBAQHbI4LPUUBAQMB2hPe+972oVqu49NJLtXuVSkVjApqFU045BR0dHbj88sslE7hf//rX6Orqwlvf+tbs2vjx49HV1eVd93HHHYfZs2dr17/2ta+hWq3igx/8IGtep5ricdh3331RLpdx//33S9d/+tOfSr932WUXnHTSSfjNb36DJUuWsO2Uy2W8+c1vxk033YTFixdn91evXo1rrrkGJ5xwAiZNmgQAWL9+vVTHhAkTcNBBB6Gvrw9AGpp72rRp+PnPf46VK1dq/V67dq127bHHHhvyHFQBAQEBIw1BcxQQEBDQgvjNb36D2267Tbv+hS98oaF6X//61+Occ87B9OnTMWfOHLz5zW9Ge3s75s+fj+uvvx4/+tGP8J73vKehNjjssssuuPDCC3HJJZfgtNNOw9vf/nbMmzcPP/3pT/HqV79aikx3zDHH4LrrrsP555+PV7/61ZgwYQLOOOMMY93veMc78Ic//AEvvPACXvayl2XXTzzxRPzkJz/B5z73ORx88ME466yzcOihh6K/vx8vvPACrr76anR0dGC33XYz1j158mT8+7//O3784x8jiiIceOCBuPnmm1nfrMsvvxwnnHACjj76aHzyk5/
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1000x500 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"#Линейная диаграмма\n",
|
|||
|
"plt.figure(figsize=(10, 5))\n",
|
|||
|
"df['Glucose'].plot(title='Line Plot (Glucose)')\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 24,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x500 with 0 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjIAAAGdCAYAAAAIbpn/AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAr8klEQVR4nO3de3QUZZ7/8U9DrlzSAZRchgSiRgJiGAGFFhgVMiKyDkjWVQfWoJnxFhAIjpJxlPGCQT1y8chF3RhkHUQyi4zICmLEuGi4RQEZdwNKJGgucEaTJmHSien6/eGP1iYJJE2H6grv1zl1Dv081dXffk558vHpp6pshmEYAgAAsKBOZhcAAADgK4IMAACwLIIMAACwLIIMAACwLIIMAACwLIIMAACwLIIMAACwLIIMAACwrCCzC2hvbrdbZWVl6t69u2w2m9nlAACAVjAMQ8ePH1dsbKw6dWp53qXDB5mysjLFxcWZXQYAAPDBkSNH1KdPnxb7O3yQ6d69u6QfByIiIsLkagAAQGs4nU7FxcV5/o63pMMHmZM/J0VERBBkAACwmDMtC2GxLwAAsCyCDAAAsCyCDAAAsKwOv0YGAIBzyTAM/fDDD2psbDS7lIDWuXNnBQUFnfWtUQgyAAD4SX19vcrLy3XixAmzS7GELl26KCYmRiEhIT4fgyADAIAfuN1ulZSUqHPnzoqNjVVISAg3Ym2BYRiqr6/XsWPHVFJSosTExNPe9O50CDIAAPhBfX293G634uLi1KVLF7PLCXjh4eEKDg7W4cOHVV9fr7CwMJ+Ow2JfAAD8yNeZhfORP8aK0QYAAJZFkAEAAJbFGhkAANpZv7kbz9lnfb1ggs/vLSws1KhRo3TDDTdo48ZzV/PZYEYGAABIknJycjRjxgx99NFHKisrM7ucViHIAAAA1dTU6M0339R9992nCRMmaOXKlV79b7/9thITExUWFqbrrrtOr732mmw2m6qqqjz7bNu2TaNHj1Z4eLji4uL0wAMPqLa2tl3rJsgAAACtXbtWSUlJ6t+/v6ZOnapXX31VhmFIkkpKSvSv//qvmjRpkvbu3at77rlHjzzyiNf7v/rqK91www1KTU3Vvn379Oabb2rbtm2aPn16u9bNGpl20NJvoWfzuyUAAO0pJydHU6dOlSTdcMMNqq6uVkFBga699lq99NJL6t+/v5577jlJUv/+/bV//37Nnz/f8/7s7GxNmTJFs2bNkiQlJibqhRde0DXXXKPly5f7fJ+YM2FGBgCA81xxcbF27typ22+/XZIUFBSkW2+9VTk5OZ7+K6+80us9V111ldfrvXv3auXKlerWrZtnGzdunOeOx+2FGRkAAM5zOTk5+uGHHxQbG+tpMwxDoaGhevHFF1t1jJqaGt1zzz164IEHmvTFx8f7rdZTEWQAADiP/fDDD1q1apWef/55XX/99V59kyZN0htvvKH+/fvrv//7v736du3a5fV6yJAh+uKLL3TJJZe0e80/R5ABAOA89s477+j7779Xenq67Ha7V19qaqpycnK0du1aLVy4UA8//LDS09O1Z88ez1VNJx+M+fDDD2vEiBGaPn26fve736lr16764osvtGXLllbP6viCNTIAAJzHcnJylJKS0iTESD8Gmd27d+v48eP661//qnXr1ik5OVnLly/3XLUUGhoqSUpOTlZBQYEOHDig0aNH64orrtBjjz3m9XNVezB1RqZfv346fPhwk/b7779fS5cuVV1dnebMmaM1a9bI5XJp3LhxWrZsmaKiokyoFgAA3wTyVasbNmxose+qq67yXIKdnJys3/zmN56++fPnq0+fPl5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AMAACyLIAMAACyLIAMAACyLIAMAACyLIAMAACyLIAMAACyLIAMAACyLIAMAACzL9CDz7bffaurUqerVq5fCw8N1+eWXa/fu3Z5+wzD02GOPKSYmRuHh4UpJSdHBgwdNrBgAAAQKU4PM999/r5EjRyo4OFjvvvuuvvjiCz3//PPq0aOHZ59nn31WL7zwglasWKEdO3aoa9euGjdunOrq6kysHAAABAJTHxr5zDPPKC4uTrm5uZ62hIQEz78Nw9DixYv1pz/9SRMnTpQkrVq1SlFRUVq/fr1uu+22c14zAAAIHKbOyLz99tsaNmyYbrnlFvXu3VtXXHGFXnnlFU9/SUmJKioqlJKS4mmz2+0aPny4CgsLmz2my+WS0+n02gAAQMdkapA5dOiQli9frsTERG3evFn33XefHnjgAb322muSpIqKCklSVFSU1/uioqI8fafKzs6W3W73bHFxce37JQAAgGlMDTJut1tDhgzR008/rSuuuEJ33323fv/732vFihU+HzMrK0vV1dWe7ciRI36sGAAABBJTg0xMTIwGDhzo1TZgwACVlpZKkqKjoyVJlZWVXvtUVlZ6+k4VGhqqiIgIrw0AAHRMpgaZkSNHqri42KvtwIED6tu3r6QfF/5GR0crPz/f0+90OrVjxw45HI5zWisAAAg8pl61NHv2bF199dV6+umn9W//9m/auXOnXn75Zb388suSJJvNplmzZumpp55SYmKiEhIS9Oijjyo2NlaTJk0ys3QAABAATA0yV155pd566y1lZWXpiSeeUEJCghYvXqwpU6Z49nnooYdUW1uru+++W1VVVRo1apQ2bdqksLAwEysHAACBwGYYhmF2Ee3J6XTKbrerurra7+tl+s3d2Kb9v14wwa+fDwBAR9Xav9+mP6IAAADAVwQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAAB
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"#Гистограмма\n",
|
|||
|
"plt.figure(figsize=(8, 5))\n",
|
|||
|
"df.plot.hist(column=[\"Age\"], bins=80)\n",
|
|||
|
"plt.show()\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 25,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAApwAAAHaCAYAAACtoplJAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABDZklEQVR4nO3deXQUZdr+8as7O4QkEAghkgQEJKCDIrIEF5aJRkQWiSK+MuIMKPKCDOCMA+4iCs64jiIoL0ZFQEERRQcUUHFjkSjoiGAQEBQTcCGBYAKS+/eHJ/WjSQKpJAUJfj/n1IGquvvJ091V1VdX91PtMzMTAAAA4BH/ie4AAAAATm4ETgAAAHiKwAkAAABPETgBAADgKQInAAAAPEXgBAAAgKcInAAAAPAUgRMAAACeInACAADAUwROAKiEa6+9Vs2aNTtuf2/NmjUKDQ3VN998c9z+5rEMGjRIAwcOPNHdAFALEDgB1AjPPPOMfD5fwBQXF6cePXpo8eLFx60f3bt3D+hDgwYN1LFjRz399NMqLi6ulr9x3333aeHCha5uc+utt+qqq65ScnJymes7deokn8+nadOmVUMPK+Yf//iHXn75Za1fv/64/U0AtROBE0CNMnHiRM2aNUvPPfecbr75Zu3evVuXXHKJXn/99ePWh6ZNm2rWrFmaNWuWbr/9dv36668aOnSobrnllmpp323gXLdunZYtW6YbbrihzPXZ2dn6+OOP1axZM82ePbta+lgR7du31znnnKMHH3zwuP1NALUTgRNAjdKrVy8NHjxYf/rTn/S3v/1N77//vkJCQjR37txqab+4uFiFhYVHrYmOjtbgwYM1ePBgjR07Vh9++KGaNm2qxx9/XAcPHqyWfriRmZmppKQkdenSpcz1zz//vOLi4vTggw/qo48+0rZt245b3wYOHKgFCxZo3759x+1vAqh9CJwAarSYmBhFREQoODg4YPkDDzygrl27KjY2VhEREerQoYNeeumlUrf3+XwaNWqUZs+erdNPP11hYWFasmSJqz7UqVNHXbp0UUFBgXbv3l1uXUFBgW666SYlJiYqLCxMrVu31gMPPCAzC+hPQUGBnn32Wedj+2uvvfaof3/hwoXq2bOnfD5fmevnzJmjyy+/XJdeeqmio6M1Z86cMuveffddnXPOOQoPD1eLFi305JNP6q677iqz3eeff14dOnRQRESEGjRooEGDBmnHjh2l6i688EIVFBRo6dKlR70PAH7fgo9dAgDHT15enn744QeZmXbt2qXHHntM+/bt0+DBgwPqHn30UfXt21dXX321Dhw4oBdeeEFXXHGFXn/9dfXu3Tug9u2339a8efM0atQoNWzYsFKDfbZs2aKgoCDFxMSUud7M1LdvX73zzjsaOnSozjrrLL355pv6+9//ru+++04PP/ywJGnWrFkaNmyYOnXqpOuvv16S1KJFi3L/7nfffaft27fr7LPPLnP96tWrtXnzZmVmZio0NFQDBgzQ7NmzS338/+mnn+riiy9WkyZNdPfdd+vQoUOaOHGiGjVqVKrNe++9V7fffrsGDhyoYcOGaffu3Xrsscd0wQUX6NNPPw14DNq2bauIiAh9+OGHuuyyy472EAL4PTMAqAEyMzNNUqkpLCzMnnnmmVL1+/fvD5g/cOCAnXHGGdazZ8+A5ZLM7/fbF198UaF+dOvWzVJSUmz37t22e/du+/LLL2306NEmyfr06ePUDRkyxJKTk535hQsXmiSbNGlSQHuXX365+Xw+27x5s7Osbt26NmTIkAr1Z9myZSbJFi1aVOb6UaNGWWJiohUXF5uZ2VtvvWWS7NNPPw2o69Onj9WpU8e+++47Z1l2drYFBwfb4S8F27Zts6CgILv33n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DFBQUpLvvvrvUx/hm5nyntMSGDRtUWFiorl27Vuj+APh94gwngBpl8eLFzlnBXbt2ac6cOcrOztb48eMVFRUlSerdu7ceeughXXzxxfqf//kf7dq1S1OnTlXLli312WefnZB+9+nTRz169NCtt96qbdu26cwzz9Rbb72lV199VWPGjAm49FGHDh20bNkyPfTQQ0pISFDz5s3VuXPnctvu16+fXnnllYDvSs6ePVuxsbHlBr2+fftqxowZeuONNzRgwADdddddeuutt3TuuedqxIgRTjg+44wztG7dOud2LVq00KRJkzRhwgRt27ZN/fv3V7169bR161a98soruv766/W3v/3NqV+6dKnq1KmjCy+8sIqPIICT2okbIA8A/19Zl0UKDw+3s846y6ZNm+Zc9qfEzJkzrVWrVhYWFmYpKSmWmZlpd955px15WJNkI0eOrHA/unXrZqeffvox6468LJKZ2d69e23s2LGWkJBgISEh1qpVK/vXv/5Vqu8bN260Cy64wCIiIkzSMS+R9Mknn5gke//9983MLDc314KDg+1Pf/pTubfZv3+/1alTxy677DJn2fLly619+/YWGhpqLVq0sP/7v/+zm266ycLDw0vd/uWXX7bzzjvP6tata3Xr1rWUlBQbOXKkbdq0KaCuc+fONnjw4KP2HwB8ZmUMfQQA1Ch//OMflZCQoFmzZlVru/3799cXX3yh7Oxs17ddt26dzj77bH3yySc666yzqrVfAE4uBE4AqAVWr16t888/X9nZ2QEDkNz45ZdfAkbsl4z6HzJkiGbMmOG6vUGDBqm4uFjz5s2rVH8A/H4QOAHgd6JJkya69tprdeqpp+qbb77RtGnTVFRUpE8//ZTLGgHwFIOGAOB34uKLL9bcuXOVk5OjsLAwpaam6r777iNsAvAcZzgBAADgKa7DCQAAAE8ROAEAAOCpGvcdzuLiYu3cuVP16tVz9fNvAAAAOD7MTHv37lVCQoL8/mOfv6xxgXPnzp1KTEw80d0AAADAMezYsUNNmzY9Zl2NC5z16tWT9NsdKPkZOwAAANQc+fn5SkxMdHLbsdS
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x500 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"plt.figure(figsize=(8, 5))\n",
|
|||
|
"df['Age'].value_counts().plot(kind='bar', title='Bar Plot (Age)')\n",
|
|||
|
"plt.show()\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 26,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAApsAAAHDCAYAAABrp9FjAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAstUlEQVR4nO3de3xU9Z3/8fckIZcmmUFCbpQEUuIKyEVFC0GogNFAwYdZglpvILBeINCSCJawVopVom4RoRugspjYIkWhQAEXvGQFqU1Q02VLqouIwURJBlAyQ7JkoMn8/uDH6Mh1kvlmkvB6Ph7n0eackzOf9A/2tefMOcfidrvdAgAAAAwICvQAAAAA6LiITQAAABhDbAIAAMAYYhMAAADGEJsAAAAwhtgEAACAMcQmAAAAjCE2AQAAYAyxCQAAAGOITQAAABhDbAIIKLvdroceekjJycnq1KmTLBaLZ+nZs2egxwMAtFBIoAcAcPlqaGjQj370Ix04cECTJ0/W4MGDFR4eLklatGiRjh07FuAJAQAtRWwCCJhNmzbpk08+UV5enhYuXOi1be3atcQmAHQAXEYHEDAHDhyQJA0bNuyS9rdYLJoxY4bXunHjxp11uX39+vWyWCzasWOHZ11RUZEsFosOHjzoWdfU1KQBAwbIYrGoqKjIs/6BBx4465irV69WUFCQnnnmmYvOWVtbq5ycHPXs2VNhYWHq3r27Jk6cqKNHj573d2666SYNHDjwnNuuuuoqZWRkeM29ZMkS9e/fX+Hh4YqNjdXo0aP14YcfevYpLCzUqFGjFBcXp7CwMPXt21fLly8/69g9e/aUxWLRrFmzztqWkZEhi8WicePGedbt2LHjrP9tJWns2LGyWCz65S9/ed6/EcDlidgEEDBdunSRJK8AbE2///3vtXfv3ovu9+abb2rKlCmaMWOG5s6de8F96+rqNHz4cP3mN7/RrbfeqiVLluiRRx7R//7v/+qLL7447+/df//9+tvf/qby8nKv9R988IE++eQT3XfffZ51U6dO1axZs5SUlKRnn31Wc+fOVXh4uEpLSz37LF++XD169NC8efO0aNEiJSUlafr06SooKDjrs8PDw/XKK6/o1KlTnnVffPGFiouLPV9ruJB3331X//mf/3nR/QBcnriMDiBgbr/9ds2dO1dPPvmk4uPjvb6z+e3wMcHlcumJJ57QmDFjtG3btvPuV1ZWpqysLGVmZuqFF1646HH/7d/+TeXl5dqwYYP++Z//2bP+8ccfl9vtPu/v3XHHHZo5c6ZWr17tdfZ09erVioyM1Pjx4yVJ77zzjoqKivTTn/5US5Ys8ez36KOPeh1/586dioiI8Pw8Y8YMjR49Ws8//7yys7O9Pnv48OH67//+b23evFlZWVmSTp8JHjx4sL788suL/s2PPfbYRf93BHD54swmgIDp1q2b/vKXv6h///6aMGGCkpKSFBsbq9jYWL355ptGP7ugoEBfffWV5s+ff959PvvsM40dO1bXXHONfv/73yso6OL/ZP7xj3/UwIEDvULzDIvFct7fs9lsuv322/WHP/zBE42NjY169dVXlZmZqcjISM/xLRbLOef+9vG/HZoOh0NHjx7VTTfdpM8++0wOh8Pr90JDQ3XvvfeqsLDQs66oqEiTJ0++6N+7YcMGffDBB5f09QIAlydiE0BAXX311dq2bZt69eql7t2766233tJbb72lwYMHG/tMh8OhhQsXKjc3V/Hx8efcp76+XhkZGbLb7fr6668vGIrfduDAAfXr169Zc02cOFGVlZXatWuXJOntt9+W3W7X/fff73X8bt26eb6CcD7vvfee0tPTFRkZqc6dOys2Nlbz5s2TpLNiU5ImT56s7du3q7q6Wjt37lR1dbXuvPPOC35GY2Oj5s2bp3vvvVcDBgzw9c8FcJkgNgEE3IoVK3TgwAHl5+crPT1d6enp6tq1q7HPe/bZZxUUFKQ5c+acd5+jR4/q1KlT2rJli/bt26f8/Hxj85yRkZGh+Ph4rV69WtLpS+gJCQlKT0/36TgHDhzQzTffrKNHj+r555/X66+/rrfeeks5OTmSTt9g9F0DBw7UwIED9bvf/U6FhYXKysqS1Wq94OesWrVKBw8e1K9+9Suf5gNweSE2AQSUw+HQggULdMMNN+jee+81/nmHDh3SkiVL9Pjjjys6Ovq8+33ve9/T9u3bNW7cOOXk5GjhwoX6+OOPL3r8Xr16nXWTz6UKDg7WPffco/Xr1+vYsWPatGmT7r77bgUHB3sd/9ChQ/r666/Pe5wtW7bI5XJp8+bNevjhh/XjH/9Y6enpXpfWz2XKlClauXKl1q9ff9FL6P/3f/+nBQsWaPr06erRo4dvfyiAywqxCSCgFi5cqKNHj2rx4sWXfKm6JRYsWKD4+Hg98sgjF9wvNjZWvXv3liQ9+eST6t69ux588MEL3uQjSVlZWfqf//kfbdy48axtF/td6fRd6ceOHdPDDz+suro6r7vQzxzf7XZrwYIF5z3+mTj99uc5HA6v72Seyz333KMvv/xScXFxGjFixAX3XbJkierr6/Wv//qvF/2bAFzeuBsdQMB8/vnnWrp0qe68807deOONl/Q7lZWV2r59u+fnI0eO6MSJE17r9uzZI0l6//33deWVV+r73/++Z9ubb76pV155RaGhoZc8Z0REhF588UWlp6dr+fLlmj59+nn3nTNnjtavX6877rhDU6ZM0aBBg/T1119r8+bNWrFixXmfpXnGtddeq379+mndunXq06ePrrvuOq/tI0eO1P3336+lS5dq//79Gj16tJqamrRr1y6NHDlSM2bM0K233qrQ0FDddtttnmhduXKl4uLiVF1dfd7PvuKKK1RdXa3g4OCLhv+bb76pp59+WjExMRfcDwCITQABM2/ePLndbj377LOX/DtbtmzRli1bzlo/ZsyYs9b9/Oc/V1xcnB544AHPumuuuUZ33323z7PefPPNmjx5svLy8nT77bd7Bey3RUVFadeuXZo/f742btyol19+WXFxcbr55pvVvXv3S/qsiRMn6rHHHvO6MejbCgsLNWDAAK1atUpz5syRzWbT9ddfr6FDh0o6/RD49evX6/HHH9fs2bOVkJCgadOmKTY2VlOmTLngZ3fu3PmSZkxMTDzng+AB4Lss7ku5rgMA7dCIESP0wAMPeMVme7BkyRLl5OTo4MGDSk5ODvQ4ANAifGcTANoQt9utVatW6aabbiI0AXQIXEYH0GH98Ic/PO/l7ramvr5emzdv1jvvvKO9e/fqT3/6U6BHAgC/4DI6ALQBBw8eVEpKijp37qzp06fr6aefDvRIAOAXxCYAAACM4TubAAAAMMan2OzZs6csFstZS3Z2tiSpoaFB2dnZiomJUVRUlLKysmS3240MDgAAgLbPp8voR44cUWNjo+fn8vJy3XLLLXrnnXc0YsQITZs2Ta+//rqKiopks9k0Y8YMBQUF6b333rvkgZqamnTo0CFFR0e3yttEAAAA4Bu3263jx4+rW7duCgq6yLlLdwv87Gc/c/fq1cvd1NTkrq2tdXfq1Mm9bt06z/aPP/7YLcldUlJyycesqqpyS2JhYWFhYWFhYWnjS1VV1UXbrtmPPjp58qRWr16t3NxcWSwWlZWV6dSpU0pPT/fs07t3byUnJ6ukpERDhgy5pONGR0dLkqqqqmS1Wps7HgAAAAxxOp1KSkrydNuFNDs2N23apNraWs+bOWpqahQaGnrWq87i4+NVU1Nz3uO4XC65XC7Pz8ePH5ckWa1WYhMAAKANu5SvPDb7bvRVq1ZpzJgx6tatW3MPIUnKz8+XzWbzLElJSS06HgAAANqOZsXm559/rrffflv/8i//4lmXkJCgkydPqra21mtfu92uhISE8x4rLy9PDofDs1RVVTVnJAAAALRBzYrNwsJCxcXFaezYsZ51gwYNUqdOnVRcXOxZt2/fPlVWViotLe28xwoLC/NcMufSOQAAQMfi83c2m5qaVFhYqEmTJikk5Jtft9lsmjp1qnJzc9WlSxdZrVbNnDlTaWlpl3xzEAAAADoWn2Pz7bffVmVlpaZMmXL
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x500 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"plt.figure(figsize=(8, 5))\n",
|
|||
|
"df[\"BMI\"].plot(kind = \"box\", title='Ящик с усами')\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 32,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x500 with 0 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjIAAAGzCAYAAAA1yP25AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9eZxdR3Un/q3X3WrJkmVb3mRjMMZm8+AAIQwBEpZAzE7AEEIIiwODE2KTAGHCMD8IGEg82ZkJi8knCSHBBAIxITCBYGIwGbYACfGGjSVLlmSppd67X7/13jq/P2o7tdz77ut+LXXb93zUeu/dW3Xq1HbOqVOnTgkiItRQQw011FBDDTVsQmicaAJqqKGGGmqooYYaVgu1IlNDDTXUUEMNNWxaqBWZGmqooYYaaqhh00KtyNRQQw011FBDDZsWakWmhhpqqKGGGmrYtFArMjXUUEMNNdRQw6aFWpGpoYYaaqihhho2LdSKTA011FBDDTXUsGmhVmRqqKGGGmqooYZNC7UiU0MN93F42tOehqc97WnHrby/+7u/w65du9BsNteERwiBd7/73aMhqobKcO211+JBD3oQut3uiSalhhoqQa3I1FBDAj70oQ9BCIEnPOEJJ5qUQnjwgx8MIYT9O+uss/DTP/3T+OxnPzsS/K1WC+9+97vxta99rXKePM/xrne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RrX/tavPe978WuXbvQaDTwpje9yeIZBGeccUb
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"plt.figure(figsize=(8, 5))\n",
|
|||
|
"df[['Glucose', 'BMI']].plot(kind='area', alpha=0.2, title='Area Plot (Glucose, BMI)')\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 28,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Axes: xlabel='Age', ylabel='Glucose'>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 28,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAGwCAYAAABPSaTdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB630lEQVR4nO2deXgV5dn/vwcSQgLZSQiBhBBERFkEWQwgglIUfbUobZViQUCt/nADrYpat2qxtVpbpdoFUV7F7X0Vqb61IiKIRFkj4hICYQlCSAhZSAIhkPn9Qc+BczLzPHNmOTNz8v1cV64LZs7MPLOcM/dz39/7vn2KoigghBBCCIlS2jk9AEIIIYQQO6GxQwghhJCohsYOIYQQQqIaGjuEEEIIiWpo7BBCCCEkqqGxQwghhJCohsYOIYQQQqKaGKcH4AZaWlqwb98+JCYmwufzOT0cQgghhOhAURQcPnwY2dnZaNdO239DYwfAvn37kJOT4/QwCCGEEGKAsrIy9OjRQ3M9jR0AiY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4XGjgM4VZ3VruOKZv2injwyIegJSSq3XWJgvdVotYSgbhRdm8Gp6rxmz9drVZDthNeCtHUYxnIAu0MCq4or8KcV2/BZyGzcjuOa7ckjCglFwpOhFnoze1w7768TITQnU7HNnK/XqiDbCa8FaevQsxNh7AwJ7K5qwKQFn6O6sTmwLDUhFstmj0ZzS4stxzU76xcJQZMTYm3zZIhmumY8CnaHfMz0+zKKk6nYRoXCXqyCbBe8FoTQsxNx9IoujaT4hho6AFDd2IwrF6yxTexp1ax
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.plot.scatter(x=\"Age\", y=\"Glucose\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 29,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAGrCAYAAACVJgNuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA/VElEQVR4nO3dd3xT5eIG8OckTdp0D7optJS9ZVUcoIiouHCAIAqKCipernpVHNeLOH/XiQNRcIAIKIiouC5DQECQDWVaKIUuuvdKmry/PyqV2pauJO/JyfP9fPqRnpwkT9OaJ+ec97xHEUIIEBERqYxOdgAiIqKGsKCIiEiVWFBERKRKLCgiIlIlFhQREakSC4qIiFSJBUVERKrEgiIiIlViQRERkSqxoMiu7rrrLsTGxkp57pSUFCiKgtdff13K8zeHzWZD79698dJLL8mO4rLGjx+PcePGyY5BTsCComZZuHAhFEWp/fLy8kLXrl3x0EMPISsry+HPv2/fPtxxxx2IiY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HF198sUWZ/P39MWzYMLz66quwWCyIjo7GmjVrGty6OZ+BAwcCAGbMmIGrrroKer0e48ePb3T9G2+8ES+88AI2bdqEUaNG1S7v0qULFi1ahIkTJ6JPnz645557EBcXh5SUFHz88cfIzc3FsmXLaoeHAzXz0c2cORM33XQTZsyYgfLycsybNw9du3atN8hj4MCBWLduHd58801ERUUhLi4OCQkJePnll7FmzRoMHz4cU6dORY8
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x500 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"plt.figure(figsize=(8, 5))\n",
|
|||
|
"df['Outcome'].value_counts().plot(kind='pie', autopct='%1.1f%%', title='Pie Chart (Outcome)')\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"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.12.7"
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 2
|
|||
|
}
|