AIM-PIbd-31-Afanasev-S-S/lab_1/lab1.ipynb

181 lines
170 KiB
Plaintext
Raw Normal View History

2024-09-14 00:17:30 +04:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Начало лабораторной\n",
"\n",
"Выгрузка данных из csv файла в датафрейм"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Index(['Pregnancies', 'Glucose', 'BloodPressure', 'SkinThickness', 'Insulin',\n",
" 'BMI', 'DiabetesPedigreeFunction', 'Age', 'Outcome'],\n",
" dtype='object')\n"
]
}
],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"df = pd.read_csv(\"C:/Users/TIGR228/Desktop/МИИ/Lab1/AIM-PIbd-31-Afanasev-S-S/static/csv/diabetes.csv\")\n",
"print(df.columns)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1IAAAInCAYAAACSvmjBAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB8V0lEQVR4nO3dd3gU5fr/8c9uSIWEkAQSAqEEkA4qTcATOgERpBw9iEhRaUdUwAYeFbCBDeGI5ehRrGBDUeCIUgVpCkoQKdIjUjSUBEghZJ/fH/yyX5ZsQiaF7Cbv13XtBTsz98w9M89O9t6ZecZmjDECAAAAAOSbvaQTAAAAAABvQyEFAAAAABZRSAEAAACARRRSAAAAAGARhRQAAAAAWEQhBQAAAAAWUUgBAAAAgEUUUgAAAABgEYUUAAAAAFhEIQUAAAAAFlFIAVfQ3r17NWrUKMXGxiogIEAhISFq3769Zs2apbS0tJJODwAAAPlUrqQTAMqKxYsX6+abb5a/v7+GDBmiJk2a6Ny5c/r+++/14IMP6tdff9Ubb7xR0mkCAAAgH2zGGFPSSQCl3f79+9WsWTNVr15dK1asUNWqVV3G79mzR4sXL9Z9991XQhkCAADACi7tA66A5557TmfOnNFbb72Vo4iSpLp167oUUTabTWPHjtWHH36o+vXrKyAgQC1atNDq1atzxP7xxx+64447FBkZKX9/fzVu3Fhvv/222zymTJkim82W49WxY0eX6Tp27KgmTZrkiH/hhRdks9l04MABl+Fff/21/va3v6l8+fIKDg5Wr1699Ouvv+aI37lzp/7+978rLCxMAQEBatmypb766iu3uV7swIEDstlseuedd5zDTp8+rRYtWqh27do6cuSIc/jZs2d1//33KyYmRv7+/qpfv75eeOEFufvN6J133rns9sie5uJ1djgcatasWY6catWqpWHDhrksY9WqVbLZbFq1apXL8I0bN6pHjx6qWLGigoKC1KFDB61duzZHjn/88YfuvPNORUdHy9/fX7Vr19aYMWN07ty5XPO/+JWd37Bhw1yGV6pUSR07dtSaNWtyLPPVV19V48aN5e/vr+joaN199906depUjukulVv7KlfO9eKH7P3p7nUxm82mKVOmON8fPXpUQ4YMUeXKleXv768mTZrozTffdDvvomorx48fV8+ePVW9enX5+/uratWquu2223Tw4MEcy3zhhRcuu23y49NPP1WLFi0UGBioiIgIDR48WH/88Ydz/KX70t0ru73WqlVLN954Y45ljB07Nkc+58+f15NPPqk6derI399ftWrV0iOPPKKMjIwc8V9//bU6dOig4OBghYSEqFWrVpo7d65zfMeOHXMcV3788ccc+/ly63HxPDIyMjR58mTVrVtX/v7+iomJ0UMPPeQ2Pyuf7U2bNrndD9mGDRumChUq5Bj+2Wefuf1sX27/5ebSnIOCgtS0aVP997//zTHtihUrnMfc0NBQ3XTTTdqxY4fLNK+99pqaN2+uihUrqnz58mrevLneeustt+u2b98+xcfHq3z58oqOjtYTTzyR45j5wgsvqF27dgoPD1dgYKBatGihzz77zO26fPDBB2rdurWCgoJUqVIlxcXF6dtvv5V0oU3mtc9r1apVoGUCJYFL+4ArYOHChYqNjVW7du3yHfPdd9/p448/1r333it/f3+9+uqr6tGjh3744QdnkXPs2DFdd911zsKrcuXK+vrrr3XnnXcqJSVF48aNczvv1157zfnFYNKkSYVat/fff19Dhw5VfHy8nn32WaWmpuq1117T9ddfr59//tn5R/HXX39V+/btVa1aNU2cOFHly5fXJ598or59+2r+/Pnq169fvpeZmZmpAQMGKDExUWvXrnUWp8YY9enTRytXrtSdd96pq6++Wt98840efPBB/fHHH3rppZfczu+ll15SRESEJOnpp5/O1zr/8ssv+c73UitWrFDPnj3VokULTZ48WXa7XXPmzFHnzp21Zs0atW7dWpJ0+PBhtW7dWqdOndLIkSPVoEED/fHHH/rss8+UmpqquLg4vf/++875Zuf+r3/9yzns4jYXERHh3AaHDh3SrFmzdMMNN+j3339XaGiopAtf+KdOnaquXbtqzJgx2rVrl1577TX9+OOPWrt2rXx9fS+7fhe3L0my293/Zjdy5Ej97W9/kyR9/vnn+uKLL3Kd57lz59S1a1ft3LlTY8aMUf369bVgwQKNHDlSx48f18SJE93GFbatnDt3TsHBwbrvvvsUHh6uvXv36uWXX9bWrVsL1QZy884772j48OFq1aqVpk2bpmPHjmnWrFlau3atfv75Z4WGhmrUqFHq2rWrM+b2229Xv3791L9/f+ewypUrW172XXfdpXfffVd///vfdf/992vjxo2aNm2aduzY4bJv3nnnHd1xxx1q3LixJk2apNDQUP38889asmSJBg0alOv8H3744RzDLm6/a9as0RtvvOHyeYyMjJR04ceLPn366Pvvv9fIkSPVsGFD/fLLL3rppZf022+/acGCBW6XafWzXVj52X+Xk51zSkqK3n77bY0YMUK1atVy7vNly5apZ8+eio2N1ZQpU5SWlqaXX35Z7du3108//eQ85p4+fVrdu3dXnTp1ZIzRJ598orvuukuhoaEaMGCAc3lZWVnq0aOHrrvuOj333HNasmSJJk+erPPnz+uJJ55wTjdr1iz16dNHt912m86dO6ePPvpIN998sxYtWqRevXo5p5s6daqmTJmidu3a6YknnpCfn582btyoFStWqHv37po5c6bOnDkjSdqxY4eeeeYZPfLII2rYsKEkuRw78rtMoMQYAMUqOTnZSDI33XRTvmMkGUlm06ZNzmEHDx40AQEBpl+/fs5hd955p6latapJSkpyiR84cKCpWLGiSU1NdRn+yCOPGEku0zdu3Nh06NDBZboOHTqYxo0b58jr+eefN5LM/v37jTHGnD592oSGhpoRI0a4THf06FFTsWJFl+FdunQxTZs2Nenp6c5hDofDtGvXztSrVy/P7bF//34jycyZM8c4HA5z2223maCgILNx40aX6RYsWGAkmaeeespl+N///ndjs9nMnj17XIa/+eabRpI5ePCgy7pfvD3mzJnjss7p6emmRo0apmfPns6cstWuXdsMGTLEZRkrV640kszKlSud61yvXj0THx9vHA6Hc7rU1FRTu3Zt061bN+ewIUOGGLvdbn788ccc2+Ti2Nxyv9jQoUNNzZo1XYa98cYbRpL54YcfjDHG/Pnnn8bPz890797dZGVlOaebPXu2kWTefvttt/PONnnyZCPJ/PXXX3lOt3v3biPJvPvuuzliLybJTJ482RhjzMsvv2wkmddff905/vz586ZLly7G39/f2aaLq61c7LnnnnP5HGUv8/nnn881xt36XercuXOmSpUqpkmTJiYtLc05fNGiRUaSefzxx93GXbydLlWzZk3Tq1evHMPvvvtul3y2bNliJJm77rrLZboHHnjASDIrVqwwxhhz6tQpExwcbNq0aeOSozGubfLStvi///3PSDI9evTIdTtc+lm72Pvvv2/sdrtZs2aNy/DXX3/dSDJr1651GW7ls+3u83WxoUOHmvLly+cY/umnn7p8tgu6/y7N5+L1/+2334wk89xzzzmHXX311aZKlSrm+PHjzmEJCQnGbrfnOP5c7Pz58yYkJMSMHTvWZd0kmXvuucc5zOFwmF69ehk/Pz+Xz/Klf0/OnTtnmjRpYjp37uwctnv3bmO3202/fv1cjiHZ873UpcfHS+VnmUBJ4tI+oJilpKRIkoKDgy3FtW3bVi1atHC+r1Gjhm666SZ98803ysrKkjFG8+fPV+/evWWMUVJSkvMVHx+v5ORk/fTTTy7zTE9PlyQFBARcdvlZWVku80xKSlJqaqrLNEuXLtWpU6d06623ukzn4+OjNm3aaOXKlZKkEydOaMWKFbrlllt0+vRp53THjx9XfHy8du/ena9LXyTpwQcf1IcffqhPPvnEeeYm2//+9z/5+Pjo3nvvdRl+//33yxijr7/+2mX4uXPnJEn+/v75WrYkvfL
"text/plain": [
"<Figure size 1000x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Группируем данные по возрасту и вычисляем среднее значение глюкозы для каждой возрастной группы\n",
"average_glucose_by_age = df.groupby('Age')['Glucose'].mean()\n",
"# Постройте гистограмму для среднего значения глюкозы относительно возраста\n",
"plt.figure(figsize=(10, 6))\n",
"average_glucose_by_age.plot(kind='bar', edgecolor='black')\n",
"plt.title('Среднее количество глюкозы относительно возраста')\n",
"plt.xlabel('Возраст')\n",
"plt.ylabel('Среднее количество глюкозы')\n",
"plt.grid(True)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Данная диаграмма отображает среднее количество глюкозы для каждой возрастной группы, что позволяет сделать вывод о том, как уровень глюкозы изменяется с возрастом."
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1cAAAIjCAYAAADvBuGTAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAADL+klEQVR4nOzdeXwTZf4H8M9Mzh7pRU9KoZVygyiwKoc/RaAc3seuK64C4rGurrq46y4eC3ghouuxeK4i6nrgsbqHIiBeXB5YUatc7VIKhbbQO2nSyWTm90dtltAU+qQZmrSf9+vF60UmT5585/k+mebJzDyPpOu6DiIiIiIiIuoUuasDICIiIiIi6g44uCIiIiIiIgoDDq6IiIiIiIjCgIMrIiIiIiKiMODgioiIiIiIKAw4uCIiIiIiIgoDDq6IiIiIiIjCgIMrIiIiIiKiMODgiojIAKqqoqqqCmVlZV0dChERER0nHFwREYXJrl27cM011yArKwtWqxUZGRkYO3YsdF3v6tDIIP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ve/ePfdd/Hzn/8ceXl5qKysxDPPPIMzzjgDP/74I3r37g2g5fh0zjnnYN26dfjlL3+Jm2++GY2NjVi7di2KioowefLkgJz/4x//wDvvvBOwrX///kLvSRQVdCKKSC+88IIOQP/Pf/6j9+/fXwegFxQUBC2rKIqenp6uDx8+XHe73f7t//nPf3QA+p///OeA8l6vVwegL1q0qM377d69278NgL5gwQL/49tuu01PT0/XR48erZ9xxhn+7YsWLdIB6JqmBbxPv3799FmzZvkf33PPPXpcXJy+c+fOgHJ/+tOfdJPJpJeVlem6rusfffSRDkC/6aab2uzrke/RXuytPv74Yx2A/vHHH/u3eTweXZZl/Te/+Y1/2wUXXKBbrVa9pKTEv23//v26w+HQ/+///q9NvYebNWuWDkCfPXt2wPYFCxboAPR///vfuq7remNjo56UlKRfc801AeUqKir0xMTEgO2tdf72t78N2Pezzz5bt1qt+sGDB3Vd1/X169frAPRXXnkloM4PPvigzfZ+/frpU6ZM0VNTU/W33nrLv/2ee+7Rx40bp/fr108/++yz/dtffvllXZZlff369QF1P/300zoAfePGjf5tAPQbbrihTducffbZer9+/fyPd+/erQPQly5d2qbssGHDAvrVo48+qgPQ//73v/u3KYqijx07Vo+Pj9cbGhp0XQ9vfxHd5458PoLZunWrDkC/+uqrA7b//ve/1wHoH330UZvXBOvLrbqyXUNph1mzZgX0i8PNnTtXz8rK0g8dOhSw/Ze//KWemJioNzU1BWy//PLL9by8vIBtR8Y0a9YsPS4uLuj7He7Iz0CrG264QT/8K1Mo+TtcsP1/9tlndQD6l19+qeu6rldVVelWq1UvKCjQfT6fv9yyZct0APry5cvbrf/LL7/UAQR8zvv166cD0N9++23/tvr6ej0rK0s/+eST/ds8Hk/A++l6S/+y2Wz63Xff7d+2fPlyHYD+l7/8pc37B/vctR4Pg+noexJFA14WSBThZs+ejb1792LmzJlYs2YN3nzzzTZltmzZgqqqKvzmN78JOPtw9tlnY/DgwXjvvfcCyiuKAgCw2WwdjqO8vBx//etfcdddd7X5tTw9PR1Ay6+vR/Pmm2/i9NNPR3JyMg4dOuT/N3nyZPh8Pnz22WcAgLfffhuSJGHBggVt6gh15r36+nocOnQIZWVlePDBB6FpGs466ywALb/ArlmzBhdccAFOOOEE/2uysrIwc+ZMbNiwAQ0NDcd8jz/84Q8Bj3/3u9/BZDL523/t2rWoq6vDZZddFrD
"text/plain": [
"<Figure size 1000x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Постройте диаграмму рассеяния для столбцов \"Age\" и \"Pregnancies\"\n",
"plt.figure(figsize=(10, 6))\n",
"plt.scatter(df['Age'], df['Pregnancies'], alpha=0.5)\n",
"plt.title('Количество беременностей относительно возраста')\n",
"plt.xlabel('Возраст')\n",
"plt.ylabel('Количество беременностей')\n",
"plt.grid(True)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Данная диаграмма отображает количество беременностей относительно возраста, что позволяет сделать вывод о том, как частота беременностей изменяется с возрастом."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Figure size 1000x600 with 0 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHHCAYAAABZbpmkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACjrUlEQVR4nOzdd3hTZfvA8W+694S27DLK3kMpIKAUiixBRFEQURT1BRRREVRkiPNFwdeBovxQFBQFQWUoQ4ZAGbL3KC27lNK90+T8/jhN2tAWmpK2SXp/risXzcnJOc9JQ3Pnee7nfjSKoigIIYQQQtgph8pugBBCCCFEeZJgRwghhBB2TYIdIYQQQtg1CXaEEEIIYdck2BFCCCGEXZNgRwghhBB2TYIdIYQQQtg1CXaEEEIIYdck2BFCCCGEXZNgRwghhBB2TY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kajYaoqKjbvqblQYaxyskff/xBgwYN6NKlS6mfs3XrVpYtW8YLL7yAq6srX3zxBX379mXPnj3GQOTatWt07tzZ+GavXr0669atY8yYMaSmpjJx4sRijz1//ny8vLwAmDp16h1d2/fff88TTzxBZGQkH3zwAZmZmcyfP59u3bpx4MAB4x+SY8eO0bVrV2rVqsWUKVPw9PTk559/ZvDgwaxYsYIhQ4aUeI6MjAxq167NwIED8fHx4ejRo3z++edcvnyZP/74w+w2nzt3jlWrVjFs2DDq16/PtWvX+Oqrr+jRowfHjx+nZs2aZh0vMzOTHj16cPnyZZ599lnq1q3Lzp07mTp1KlevXmXevHlmt7E427ZtY+3atUW2l/V9UJLk5OQigYa50tPTueeeezhx4gRPPfUU7du3JyEhgd9//51Lly7Rtm1bhgwZwrJly/j4449xdHQ0PvfHH39EURRGjBhR5LhNmzbljTfeACAhIYGXXnrptm157bXX7uhaAD755BMGDRrEiBEjyM3N5aeffmLYsGGsXr2a/v37m308c9tUu3btIr+T4r44AcydO5dq1aoB8M4779zyuGfPnqVnz554eHjw6quv4uHhwddff01ERAQbNmyge/fuxT7v4sWL9O3bl6ZNm/Lzzz/j5KR+fFy7do0uXbqQmZnJCy+8QGBgIN999x2DBg1i+fLlxv/naWlpNGvWjIcffhgPDw+ioqL48MMPyczM5NNPPzXrtSmt3r17M2rUKJNtH330EUlJScb7iqIwaNAgNm/ezJgxY2jbti1//fUXr776KpcvX2bu3Lm3PY/hPaooCtHR0Xz88cf069ePCxcuGPd5+umn+e6773jooYd4+eWX2b17N++99x4nTpwoEhyMHTuWkJAQrly5wmeffUZERAQxMTF4eHgY9ynN58XevXvZuXMnw4cPp3bt2sTGxjJ//nx69uzJ8ePHjce73f/dZs2a8f333xvPvWDBAk6cOGHy2rRu3ZpWrVpRp04dlixZUuTv+5IlS2jYsCHh4eG3fT3LhSIsLiUlRQGUBx54oNTPARRA+ffff43bzp8/r7i5uSlDhgwxbhszZoxSo0YNJSEhweT5w4cPV3x9fZXMzEyT7a+//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Z3ge3cvnyZT799FOmTZtm7P27WWle4xUrVtCmTZtie+wMQzcRERHUrFmTJUuWGB87evQohw8fZuTIkUWel5ubi6ura6mvRVEUpk6dytChQ7n77ruL3Sc7O7vItWi12iL7ubu7G39OSkoiJSWFe+65x6zXtrRtKqvc3FyAUr1GKSkpxMfHs2HDBiIjI2nRooXxscDAQEaPHs2+ffu4du2ayfOys7MZNGgQ169f588//yQwMNDk8bVr13LXXXfRrVs34zYvLy/Gjh1
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"subset_df = df.iloc[0:30]\n",
"# Группируем данные по возрасту и вычисляем среднее значение инсулина и глюкозы для каждой возрастной группы\n",
"insulin = subset_df.groupby('Age')['Insulin'].mean()\n",
"glucose = subset_df.groupby('Age')['Glucose'].mean()\n",
"\n",
"# Создаем DataFrame для средних значений\n",
"average_df = pd.DataFrame({\n",
" 'Insulin': insulin,\n",
" 'Glucose': glucose\n",
"})\n",
"\n",
"# Постройте линейный график для средних значений инсулина и глюкозы\n",
"plt.figure(figsize=(10, 6))\n",
"average_df.plot.line()\n",
"plt.title('Среднее значение инсулина и глюкозы по возрасту')\n",
"plt.xlabel('Возраст')\n",
"plt.ylabel('Среднее значение')\n",
"plt.grid(True)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Данный график отображает среднее значение инсулина и глюкозы по возрасту, что позволяет сделать вывод о том, как эти показатели изменяются с возрастом."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "aimenv",
"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.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}