AIM-PIbd-31-Bakalskaya-E-D/lab_1/lab1 copy.ipynb

420 lines
127 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p style=\"text-decoration: underline; text-align: center;\">Скриншот запущенного сваггера:</p>\n",
"\n",
"<img src=\"./image.png\" style=\"width: 1000px; \"></img>\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"data_base = pd.read_csv(\"csv/option4.csv\")\n",
"\n",
"# data_base.info\n",
"\n",
"# print(data_base.describe().transpose())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p style=\"text-align: center;\"><i>Вызов функции для удобного просмотра столбцов и их значений во время выполнения лабы</i></p>"
]
},
{
"cell_type": "code",
"execution_count": 84,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<bound method DataFrame.info of id gender age hypertension heart_disease ever_married \\\n",
"0 9046 Male 67.0 0 1 Yes \n",
"1 51676 Female 61.0 0 0 Yes \n",
"2 31112 Male 80.0 0 1 Yes \n",
"3 60182 Female 49.0 0 0 Yes \n",
"4 1665 Female 79.0 1 0 Yes \n",
"... ... ... ... ... ... ... \n",
"5105 18234 Female 80.0 1 0 Yes \n",
"5106 44873 Female 81.0 0 0 Yes \n",
"5107 19723 Female 35.0 0 0 Yes \n",
"5108 37544 Male 51.0 0 0 Yes \n",
"5109 44679 Female 44.0 0 0 Yes \n",
"\n",
" work_type Residence_type avg_glucose_level bmi smoking_status \\\n",
"0 Private Urban 228.69 36.6 formerly smoked \n",
"1 Self-employed Rural 202.21 NaN never smoked \n",
"2 Private Rural 105.92 32.5 never smoked \n",
"3 Private Urban 171.23 34.4 smokes \n",
"4 Self-employed Rural 174.12 24.0 never smoked \n",
"... ... ... ... ... ... \n",
"5105 Private Urban 83.75 NaN never smoked \n",
"5106 Self-employed Urban 125.20 40.0 never smoked \n",
"5107 Self-employed Rural 82.99 30.6 never smoked \n",
"5108 Private Rural 166.29 25.6 formerly smoked \n",
"5109 Govt_job Urban 85.28 26.2 Unknown \n",
"\n",
" stroke \n",
"0 1 \n",
"1 1 \n",
"2 1 \n",
"3 1 \n",
"4 1 \n",
"... ... \n",
"5105 0 \n",
"5106 0 \n",
"5107 0 \n",
"5108 0 \n",
"5109 0 \n",
"\n",
"[5110 rows x 12 columns]>"
]
},
"execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_base.info"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p style=\"text-align: center;\"><i>Вызов иной функции для удобного просмотра столбцов и их значений во время выполнения лабы</i></p>"
]
},
{
"cell_type": "code",
"execution_count": 85,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Index(['id', 'gender', 'age', 'hypertension', 'heart_disease', 'ever_married',\n",
" 'work_type', 'Residence_type', 'avg_glucose_level', 'bmi',\n",
" 'smoking_status', 'stroke'],\n",
" dtype='object')"
]
},
"execution_count": 85,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_base.columns"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p style=\"text-align: center;\"><i>Тренируюсь со срезами...</i></p>"
]
},
{
"cell_type": "code",
"execution_count": 44,
"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>id</th>\n",
" <th>gender</th>\n",
" <th>age</th>\n",
" <th>hypertension</th>\n",
" <th>heart_disease</th>\n",
" <th>ever_married</th>\n",
" <th>work_type</th>\n",
" <th>Residence_type</th>\n",
" <th>avg_glucose_level</th>\n",
" <th>bmi</th>\n",
" <th>smoking_status</th>\n",
" <th>stroke</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>12109</td>\n",
" <td>Female</td>\n",
" <td>81.0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>Yes</td>\n",
" <td>Private</td>\n",
" <td>Rural</td>\n",
" <td>80.43</td>\n",
" <td>29.7</td>\n",
" <td>never smoked</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>12095</td>\n",
" <td>Female</td>\n",
" <td>61.0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>Yes</td>\n",
" <td>Govt_job</td>\n",
" <td>Rural</td>\n",
" <td>120.46</td>\n",
" <td>36.8</td>\n",
" <td>smokes</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" id gender age hypertension heart_disease ever_married work_type \\\n",
"10 12109 Female 81.0 1 0 Yes Private \n",
"11 12095 Female 61.0 0 1 Yes Govt_job \n",
"\n",
" Residence_type avg_glucose_level bmi smoking_status stroke \n",
"10 Rural 80.43 29.7 never smoked 1 \n",
"11 Rural 120.46 36.8 smokes 1 "
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_base.loc[10:11]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p style=\"text-align: center;\"><i>Все еще непонятной фигней занимаюсь...</i></p>"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {},
"outputs": [],
"source": [
"new_data_base = data_base.sort_values(\"age\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p style=\"text-align: center;\"><i>А тут уже что-то интересное.<br>Я отбираю количество (сколько раз встречается в таблице) каждое из значений колонки <b>\"статусурильщика\"</b> Потом с помощью функции plot отрисовываю круговую диаграмму</i></p>"
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Text(0.5, 1.0, 'Диаграмма людей с разным статусaми курения')"
]
},
"execution_count": 83,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAccAAAGbCAYAAACxsFs+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABg6UlEQVR4nO3dd3zM9x8H8Nf3LntPGUJCIpEgCLWJEasoqgmpmm2pUlU1qsNsjaKlqlUrUULNqtoz9g5iBBEJESF777vP7w+/XF2GrMt9bryfj0ce3Pe+973XXb651323wBhjIIQQQoiMiHcAQgghRNVQORJCCCElUDkSQgghJVA5EkIIISVQORJCCCElUDkSQgghJVA5EkIIISVQORJCCCElUDkSQgghJVA5Eo2wZcsWxMTEyG4HBwcjLi6OXyBCiFpTejnu2rULgiCU+dO0aVNlxyEa4uzZs5gxYwZiYmJw5MgRTJw4ESIRffcjhFSPDq8n/vrrr+Hp6Sm7/cMPP/CKQjTAF198ga5du6JBgwYAgKlTp8LBwYFzKkKIuuJWjj179kTXrl1lt9evX4+kpCRecYiaa9y4MaKionDnzh3Y2NjA1dWVdyRCiBpT+nqngoKCV09ciVVewcHBEARBbluSVCqFt7c3BEFAcHCwbHh4eDhGjx6Nhg0bwsDAAPb29hg7diySk5Plpjl37twyV+nq6Pz3PaFr165o2rQprl+/jg4dOsDQ0BANGjTAmjVrSr2W2bNno1WrVjA3N4exsTE6d+6MU6dOyY0XExMje569e/fK3ZeXlwdLS0sIgoBly5aVylmnTh0UFhbKPWbbtm2y6b3+heKff/5Bv3794OjoCH19fbi6umLBggWQSCQVvtfFXFxcynx/QkND5d6f17/YFBYW4rvvvkODBg2gp6eH+vXrY8aMGcjNzS01/dffi5I/r/+eASAtLQ1TpkxBvXr1oK+vDzc3NyxZ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ty29gYMAGDx4sG/bhhx8yBwcHlpSUJDfNYcOGMXNzc9l7Vp15uTJdMGvWLAaAxcfHy4YVf068/hlbEaWvVi1e3WBra1vlx65evRrJycmlvs0AgKGhoez/eXl5SEpKQrt27QAAYWFhVX4uHR0djB8/XnZbT08P48ePR0JCAq5fvw4AEIvF0NPTA/BqET8lJQVFRUVo3bp1mc/p4+ODJk2ayL7hPnnyBKdOnXrjqr+xY8fi8OHDePHiBYBX397bt28Pd3f3UuO+/h5kZmYiKSkJnTt3Rk5ODu7fv1+p111QUFCppfrCwkIkJSXh77//BmMMU6dOlbt/ypQpEIvFOHDggNzw4m/HBgYGb5z+zp070blzZ1haWiIpKUn24+fnB4lEUuaqHAC4fv06du7ciUWLFlVq1f3u3bshCEKZ81RZS7wl1cZ8kp6ejpcvX+LEiRM4cOAAunTpUmqc4t/v6z/lSU9PR1JSEjIzMyt8PcUGDBgAQRCwb98+AK/2Bn727BmGDh1aqcfv3r0bzZs3l1tCKlaZ9/V1r8/XhYWFSE5OhpubGywsLKr1tz1y5Eg8f/5cbrV2SEgIDA0NMWTIEADAjRs3EB0djSlTpsDCwqLc/FX93KnK3/PrcnJyMH/+fEyaNAn169ev0uv9559/8Omnn2L69OmYNGmS3H0ikQjDhw/Hvn375OaPkJAQdOjQQbaDW7H27dujVatWstv169fHwIEDceTIEUgkEjDGsHv3bgwYMACMMbn5s3fv3khPTy/1vlRlXi72pi7IzMyESCQq9XurKqWX45MnT6Cjo1PlckxPT8fChQsxdepU2NnZlbo/JSUFn3/+Oezs7GBoaAhbW1vZLzY9Pb3KOR0dHWFsbCw3rHgGfn2996ZNm+Dt7Q0
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"smoking_status_count = data_base[\"smoking_status\"].value_counts().plot(kind='pie')\n",
"\n",
"# smoking_status_count.plot(kind='bar')\n",
"plt.title(\"Диаграмма людей с разным статусaми курения\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p style=\"text-align: center;\"><i>Здесь я делаю то же самое, только теперь стилизую диаграмму (area) - подписываю <b>x</b> и <b>y</b> оси, добавляю <b>title</b></i></p>\n"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Text(0, 0.5, 'количество людей')"
]
},
"execution_count": 82,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkgAAAHHCAYAAABEEKc/AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABy1ElEQVR4nO3deXwN1/8/8NfNvu+yEQmxb0GoPbGEiK2WUsS+VqkWRfOpJaildqWtUkIrKq0qihL7GsQSISKIRCyJELKS9Z7fH36Zr3tvkFzhZnk9H4/7eOSeOTPznsncue97zpkZmRBCgIiIiIgkWpoOgIiIiKikYYJEREREpIQJEhEREZESJkhERERESpggERERESlhgkRERESkhAkSERERkRImSERERERKmCARERERKWGCRERvde3aNezcuVN6HxYWhr1792ouICKi94wJUim2adMmyGQyXLhwQWXa+vXrIZPJ0LNnT+Tl5WkgOipL0tLSMHbsWJw9exa3bt3Cl19+iatXr2o6LCKi90ZH0wFQ8fvnn38wbtw4tGnTBtu2bYO2tramQ6JSrkWLFtILAGrUqIHRo0drOCoioveHCVIZc+zYMQwYMAB16tTBv//+CwMDA02HRGXEzp07cf36dbx48QL169eHnp6epkMiInpv2MVWhoSFheHjjz+Gg4MDDhw4AHNzc5U6f/31F9zd3WFoaAgbGxsMGjQIDx48KHB5MpmswFdsbKxCHX9/f4X5lixZAplMhrZt20pl/v7+kMlkKutwcXHBsGHDFMqSk5Px1VdfwcnJCfr6+qhWrRq+//57yOVyhXpyuRyrVq1C/fr1YWBggAoVKqBz585Sl+Pr4s9/5cd37NgxhXJ9fX3U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X/FBsbK7S1tcX8+fMV5r169arQ0dFRKPf09FT4X+7bt08AEJ07dxZvO4Xk5uaKKlWqCGdnZ/Hs2TOFaQX9n16Vvx/c3d1Fdna2VL548WIBQOzatUsqe/78ucr8Y8eOFUZGRiIzM/O16zh//rwAILZv3y6VOTs7i65du6rUHT9+vMr2AhDjx49/6za8etw5OzuLjh07ChsbG4X1zps3T7Rs2fK163/VrVu3hJaWlujVq5fIy8tTmFbQfi3oGH+V8v7Lzs4W9erVE+3bty/0duU7cOCAACD+++8/hfIGDRooHEezZs0SAMSOHTtUlpG/Dbm5uSIrK0th2rNnz4SdnZ0YMWKEVBYTEyMAiAEDBggdHR2Fz0qHDh3EwIEDBQCxZMkSqXz27NkK/8/ExERhamoqfHx83rivCpo/NjZWODg4iNatWyucX4UQws/PT+jr64vk5GSFdeno6Ch8JocOHSoAiC+++EJhP3Tt2lXo6emJx48fCyGEOHnypAAgAgMDFdazf/9+lfKiHsuFOZdHRUUJAGLhwoUK83t6eoq6desWtKtKLXaxlQHDhg3DvXv3MHDgQAQHB+Ovv/5SqXPhwgUkJibi888/V/iF2rVrV9SqVUvlku3s7GwAgL6+fqHjePDgAVavXo2ZM2cq/DoFAFtbWwAvfyW/yV9//YU2bdrA0tIST548kV5eXl7Iy8vDiRMnAAB///03ZDIZZs+erbKMwnb7KEtJScGTJ08QFxeHxYsXQy6Xo3379gBe/moKDg5Gz549UbVqVWkeBwcHDBw4EKdOnUJqaupb15GdnV3offrs2TPcvHkTFy9ehK+vr0KLV/Xq1dGjRw/s379fpRspMzPzra0QO3bsgFwuR79+/RT2s729PapXr67ShZFPCAE/Pz/06dOnUC1mly9fRkxMDL766iuVFqnC/p/GjBmj8It43Lhx0NHRwb59+6QyQ0ND6e+0tDQ8efIEbdq0wfPnz3Hjxg2F5WVmZuLJkyeIjIzEqlWrYGhoiCZ
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"data_base[\"smoking_status\"].value_counts().plot(kind='area')\n",
"\n",
"# smoking_status_count.plot(kind='bar')\n",
"plt.title(\"Количество людей с разным статусaми курения\")\n",
"plt.xlabel(\"статусы курения\")\n",
"plt.ylabel(\"количество людей\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p style=\"text-align: center;\"><i>Здесь не особо интересно - делаю гистограмму с разницой в количестве мужчин и женщин испытуемых</i></p>"
]
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: xlabel='gender'>"
]
},
"execution_count": 90,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjAAAAHVCAYAAADvkMHDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAu4klEQVR4nO3de1TU9b7/8RegjKIOhMot0TBLJcUUS2elplsCFct2dlaWpiXVsrCTYmqc5TEvFW1KrXaWtTxG7qNltaxdutUIt7fELApvqeUtTBk0DSZIQWB+f/Tje5owEwOHDzwfa81azvf7mZn3uGbnc3/nOzM+brfbLQAAAIP4ensAAACAmiJgAACAcQgYAABgHAIGAAAYh4ABAADGIWAAAIBxCBgAAGAcAgYAABinibcHqCuVlZU6fvy4WrVqJR8fH2+PAwAALoLb7dZPP/2kiIgI+fr+/nGWBhswx48fV2RkpLfHAAAAl+Do0aNq167d7+5vsAHTqlUrSb/8Bdjtdi9PAwAALobL5VJkZKT17/jvabABU/W2kd1uJ2AAADDMH53+wUm8AADAOAQMAAAwDgEDAACMQ8AAAADjEDAAAMA4BAwAADAOAQMAAIxDwAAAAOMQMAAAwDg1CphXX31VMTEx1rfbOhwOrVmzxtp/9uxZJScnq3Xr1mrZsqVGjhypgoICj/vIy8tTYmKiAgICFBISoqlTp6q8vNxjzYYNG9SrVy/ZbDZ16tRJGRkZl/4MAQBAg1OjgGnXrp2effZZ5eTk6IsvvtBf/vIXjRgxQnv27JEkTZ48WR999JHeffddbdy4UcePH9cdd9xh3b6iokKJiYkqKyvT1q1b9eabbyojI0MzZ8601hw+fFiJiYkaNGiQcnNzNWnSJD3wwANat25dLT1lAABgOh+32+3+M3cQHBys5557Tnfeeafatm2r5cuX684775Qk7du3T127dlV2drb69u2rNWvWaPjw4Tp+/LhCQ0MlSYsWLdL06dN18uRJ+fv7a/r06Vq9erV2795tPcaoUaNUWFiotWvXXvRcLpdLgYGBKioq4reQAAAwxMX++33J58BUVFTo7bffVklJiRwOh3JycnTu3DnFxcVZa7p06aL27dsrOztbkpSdna3u3btb8SJJCQkJcrlc1lGc7Oxsj/uoWlN1HwAAADX+Nepdu3bJ4XDo7Nmzatmypd5//31FR0crNzdX/v7+CgoK8lgfGhoqp9MpSXI6nR7xUrW/at+F1rhcLp05c0bNmzc/71ylpaUqLS21rrtcrpo+NQAAYIgaB0znzp2Vm5uroqIivffeexo3bpw2btxYF7PVSFpammbPnu3tMQAAdeCqJ1Z7e4QG48izid4eoVbU+C0kf39/derUSbGxsUpLS1OPHj304osvKiwsTGVlZSosLPRYX1BQoLCwMElSWFhYtU8lVV3/ozV2u/13j75IUmpqqoqKiqzL0aNHa/rUAACAIf7098BUVlaqtLRUsbGxatq0qbKysqx9+/fvV15enhwOhyTJ4XBo165dOnHihLUmMzNTdrtd0dHR1ppf30fVmqr7+D02m836eHfVBQAANEw1egspNTVVQ4cOVfv27fXTTz9p+fLl2rBhg9atW6fAwEAlJSUpJSVFwcHBstvtevTRR+VwONS3b19JUnx8vKKjo3XvvfcqPT1dTqdTM2bMUHJysmw2myRpwoQJevnllzVt2jSNHz9e69ev1zvvvKPVqzl8CAAAflGjgDlx4oTGjh2r/Px8BQYGKiYmRuvWrdMtt9wiSVqwYIF8fX01cuRIlZaWKiEhQa+88op1ez8/P61atUoPP/ywHA6HWrRooXHjxmnOnDnWmqioKK1evVqTJ0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nHmg0bNqhXr16y2Wzq1KmTMjI
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"data_base[\"gender\"].value_counts().sort_values().plot(kind='bar')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<p style=\"text-align: center;\"><i>Здесь я беру данные по срезу (с 100-го челобрека по 300-го). И строю точечную диаграмму, которая отображает по иксам - курящий ли и насколько человек, а по игрекам - возраст</i></p>\n"
]
},
{
"cell_type": "code",
"execution_count": 107,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: xlabel='smoking_status', ylabel='age'>"
]
},
"execution_count": 107,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjYAAAGxCAYAAABx6/zIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABSgklEQVR4nO3deVzVVf4/8NdlFQQuq4AJsoi4pLilEoobxZiVe8bP1BrNplBHTZuxMXNp1GwxM6vJMcwpzZpJx7TUcoFEVFxwtJRFVlNWBQSS9fz+8MvNK3DlXu6Hz+deXs/H4z4ecs69n/sGjvfz5nPen3NUQggBIiIiIjNgIXcARERERMbCxIaIiIjMBhMbIiIiMhtMbIiIiMhsMLEhIiIis8HEhoiIiMwGExsiIiIyG0xsiIiIyGxYyR2A1Orq6nDt2jU4OjpCpVLJHQ4RERE1gxACt27dQseOHWFh0fzrMGaf2Fy7dg0+Pj5yh0FEREQGyMnJQadOnZr9fLNPbBwdHQHc+cE4OTnJHA0RERE1R2lpKXx8fDTn8eYy+8SmfvrJycmJiQ0REZGJ0beMhMXDREREZDaY2BAREZHZYGJDREREZoOJDREREZkNJjZERERkNpjYEBERkdlgYkNERERmg4kNERERmQ0mNkRERGQ2mNgQERGR2TD7LRWITE16QRm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LHw6U/1zIKzZ6UjW+B2aT7UTNZW9tqVc7UXPcm9QAd/aJenLTMZkiInPQ1EIxSlhARtbExs/PDyqVqsEjOjoaAHD79m1ER0fDzc0NDg4OmDhxIvLy8mSLN72grNEMFQCOXymSvWCKTFd
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"data_base.loc[100:300].plot.scatter(x=\"smoking_status\", y=\"age\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}