{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "eddff909-ea35-471a-b9e7-99dc5b0db661",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "907314cd-d60b-4300-82b8-6daa36a438ac",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = {\n",
    "    \"Имя\": [\"Анна\", \"Борис\", \"Виктор\", \"Галина\"],\n",
    "    \"Возраст\": [21, 22, 23, 24],\n",
    "    \"Баллы\": [89, 76, 95, 82]\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "45e6cbe0-d224-4b46-bdb8-51a36c6fddea",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Первый взгляд на данные:\n",
      "      Имя  Возраст  Баллы\n",
      "0    Анна       21     89\n",
      "1   Борис       22     76\n",
      "2  Виктор       23     95\n",
      "3  Галина       24     82\n",
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 4 entries, 0 to 3\n",
      "Data columns (total 3 columns):\n",
      " #   Column   Non-Null Count  Dtype \n",
      "---  ------   --------------  ----- \n",
      " 0   Имя      4 non-null      object\n",
      " 1   Возраст  4 non-null      int64 \n",
      " 2   Баллы    4 non-null      int64 \n",
      "dtypes: int64(2), object(1)\n",
      "memory usage: 228.0+ bytes\n",
      "None\n",
      "         Возраст      Баллы\n",
      "count   4.000000   4.000000\n",
      "mean   22.500000  85.500000\n",
      "std     1.290994   8.266398\n",
      "min    21.000000  76.000000\n",
      "25%    21.750000  80.500000\n",
      "50%    22.500000  85.500000\n",
      "75%    23.250000  90.500000\n",
      "max    24.000000  95.000000\n",
      "Имя        0\n",
      "Возраст    0\n",
      "Баллы      0\n",
      "dtype: int64\n"
     ]
    }
   ],
   "source": [
    "print(\"Первый взгляд на данные:\")\n",
    "print(df.head())\n",
    "print(df.info())\n",
    "print(df.describe())\n",
    "print(df.isnull().sum())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "79b8242f-deca-4496-a7da-747a63742489",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.DataFrame(data) # df объект класса DataFrame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "c0137fab-deba-4ac0-a6cf-b7efb5816607",
   "metadata": {},
   "outputs": [],
   "source": [
    "df[\"Новый столбец\"] = df[\"Баллы\"] * 1.1 # добавление нового столбца"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2e5cde96-2a54-4db6-8158-90da96a168d5",
   "metadata": {},
   "outputs": [],
   "source": [
    "grouped_df = df.groupby(\"Возраст\").agg({\"Баллы\": \"mean\"}) # от объекта df метод groupby чейнинг с методом agg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "24e306fe-0821-456a-8d59-d33567362193",
   "metadata": {},
   "outputs": [],
   "source": [
    "filtered_df = df[df[\"Возраст\"] > 21] # фильтрация по возрасту"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "6c17f9e7-ffdc-4350-a4e8-2c5c9cf9710a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "Данные с новым столбцом: \n",
      "      Имя  Возраст  Баллы  Новый столбец\n",
      "0    Анна       21     89           97.9\n",
      "1   Борис       22     76           83.6\n",
      "2  Виктор       23     95          104.5\n",
      "3  Галина       24     82           90.2\n",
      "\n",
      "Группировка по возрасту с вычислением среднего балла: \n",
      "         Баллы\n",
      "Возраст       \n",
      "21        89.0\n",
      "22        76.0\n",
      "23        95.0\n",
      "24        82.0\n",
      "\n",
      "Фильтрация (возраст > 21): \n",
      "      Имя  Возраст  Баллы  Новый столбец\n",
      "1   Борис       22     76           83.6\n",
      "2  Виктор       23     95          104.5\n",
      "3  Галина       24     82           90.2\n"
     ]
    }
   ],
   "source": [
    "print(\n",
    "    f\"\\n\\nДанные с новым столбцом: \\n{df}\"\n",
    "    f\"\\n\\nГруппировка по возрасту с вычислением среднего балла: \\n{grouped_df}\"\n",
    "    f\"\\n\\nФильтрация (возраст > 21): \\n{filtered_df}\"\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "cff2c35c-51ce-4df2-b30e-020a31e2cbfa",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "b40b022e-6707-4af1-8287-b1bc8c6682d1",
   "metadata": {},
   "outputs": [],
   "source": [
    "arr = np.array([1, 2, 3, 4, 5])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "66f111cc-7ea3-4195-a3e6-ed6098aff4f9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Сумма элементов массива: 15\n",
      "Среднее значение: 3.0\n",
      "Медиана: 3.0\n",
      "Стандартное отклонение: 1.4142135623730951\n"
     ]
    }
   ],
   "source": [
    "print(\"Сумма элементов массива:\", np.sum(arr))\n",
    "print(\"Среднее значение:\", np.mean(arr))\n",
    "print(\"Медиана:\", np.median(arr))\n",
    "print(\"Стандартное отклонение:\", np.std(arr))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "ab257d76-ac0e-4196-b556-bfe606781834",
   "metadata": {},
   "outputs": [],
   "source": [
    "matrix = np.array([[1, 2], [3, 4]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "503a1c7f-339e-492f-9acb-83edbda12fc2",
   "metadata": {},
   "outputs": [],
   "source": [
    "linspace_arr = np.linspace(0, 10, 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "2ba94214-e148-4b89-bfb5-6b089319c586",
   "metadata": {},
   "outputs": [],
   "source": [
    "random_matrix = np.random.randn(2, 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "ce244ead-6706-4ad6-8e13-c5ab6ddf8884",
   "metadata": {},
   "outputs": [],
   "source": [
    "dot_product = np.dot(matrix, random_matrix)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "9df56eb9-8baa-4d3d-b26d-e75251c4990b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Двумерный массив:\n",
      " [[1 2]\n",
      " [3 4]]\n",
      "Массив, созданный с помощью np.linspace():\n",
      " [ 0.   2.5  5.   7.5 10. ]\n",
      "Массив, созданный с помощью np.random.randn():\n",
      " [[ 0.87483977 -1.42420419]\n",
      " [-0.06200213 -0.77189905]]\n",
      "Результат матричного умножения np.dot(matrix, random_matrix):\n",
      " [[ 0.75083552 -2.96800229]\n",
      " [ 2.3765108  -7.36020878]]\n"
     ]
    }
   ],
   "source": [
    "print(\n",
    "    f\"\\nДвумерный массив:\\n {matrix}\"\n",
    "    f\"\\nМассив, созданный с помощью np.linspace():\\n {linspace_arr}\"\n",
    "    f\"\\nМассив, созданный с помощью np.random.randn():\\n {random_matrix}\"\n",
    "    f\"\\nРезультат матричного умножения np.dot(matrix, random_matrix):\\n {dot_product}\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "9ba44e18-b969-4af9-92d3-dabb3849fcc6",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "2b48f365-07ce-4679-87db-591da72a718d",
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.linspace(0, 10, 100)\n",
    "y = np.sin(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "9ddb722b-fd71-4b17-8f62-8ba4472de306",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 39632 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(x, y, label='sin(x)')\n",
    "plt.xlabel(\"X\")\n",
    "plt.ylabel(\"Y\")\n",
    "plt.title(\"График синуса\")\n",
    "plt.legend()\n",
    "plt.grid()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "ef8105a7-9c77-430c-85f1-03e29272facd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 62692 characters]",
      "text/plain": [
       "<Figure size 1000x500 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(0, 10, 100)\n",
    "y_sin = np.sin(x)\n",
    "y_cos = np.cos(x)\n",
    "\n",
    "plt.figure(figsize=(10, 5))\n",
    "plt.plot(x, y_sin, color='red', label='sin(x)')\n",
    "plt.plot(x, y_cos, color='blue', linestyle='--', label='cos(x)')\n",
    "plt.xlabel(\"X\")\n",
    "plt.ylabel(\"Y\")\n",
    "plt.title(\"Графики синуса и косинуса\")\n",
    "plt.legend()\n",
    "plt.grid()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "1bf7a280-c6f1-4ae5-9c6f-bc01563e06a0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 11400 characters]",
      "text/plain": [
       "<Figure size 600x400 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "categories = ['A', 'B', 'C', 'D']\n",
    "values = [10, 15, 7, 12]\n",
    "plt.figure(figsize=(6, 4))\n",
    "plt.bar(categories, values, color='green')\n",
    "plt.title(\"Столбчатая диаграмма\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "f6412e4b-8082-44ec-bd9e-7bb133a233c9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 20208 characters]",
      "text/plain": [
       "<Figure size 600x400 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x_scatter = np.random.rand(50) * 10\n",
    "y_scatter = np.random.rand(50) * 10\n",
    "plt.figure(figsize=(6, 4))\n",
    "plt.scatter(x_scatter, y_scatter, color='purple', alpha=0.7)\n",
    "plt.title(\"Диаграмма рассеяния\")\n",
    "plt.xlabel(\"X\")\n",
    "plt.ylabel(\"Y\")\n",
    "plt.grid()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "a174508e-a887-46c0-b0d8-7ffdd83f6d7c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 15128 characters]",
      "text/plain": [
       "<Figure size 600x400 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "data = np.random.randn(1000)\n",
    "plt.figure(figsize=(6, 4))\n",
    "plt.hist(data, bins=30, color='orange', edgecolor='black', alpha=0.75)\n",
    "plt.title(\"Гистограмма\")\n",
    "plt.xlabel(\"Значения\")\n",
    "plt.ylabel(\"Частота\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "8296337f-a422-4cd3-892c-466fad6e147b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import seaborn as sns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "1a45138d-d803-4222-b0ec-2f5f57509c47",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 15340 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df[\"Категория\"] = [\"A\", \"B\", \"A\", \"B\"]\n",
    "sns.boxplot(x=\"Категория\", y=\"Баллы\", data=df)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "752ef7de-90de-4422-9f3d-7787e13d2e39",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 18952 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.histplot(df[\"Баллы\"], bins=10, kde=True, color=\"blue\")\n",
    "plt.title(\"Гистограмма баллов\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "1b2a13e9-4687-456f-9e0c-8fbfdedb681f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 26204 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.scatterplot(x=\"Возраст\", y=\"Баллы\", hue=\"Категория\", data=df, palette=\"deep\")\n",
    "plt.title(\"Диаграмма рассеяния: возраст vs. баллы\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "6b27e34b-6a6d-409f-afa3-b78c5a4796a9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 79916 characters]",
      "text/plain": [
       "<Figure size 838.236x750 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.pairplot(df, hue=\"Категория\", diag_kind=\"kde\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "4992ed62-31ee-4bce-b7c7-622ea2c669c8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 24588 characters]",
      "text/plain": [
       "<Figure size 500x400 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(5,4))\n",
    "sns.heatmap(df.select_dtypes(include=[\"number\"]).corr(), annot=True, cmap=\"coolwarm\")\n",
    "plt.title(\"Корреляция переменных\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "deb284c3-8d75-4e6e-9580-8db848849536",
   "metadata": {},
   "outputs": [],
   "source": [
    "from tqdm import tqdm\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "0bb70285-3096-4097-bea1-22e17cbc4557",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████████████████████████████████████████████████████████████| 100/100 [00:01<00:00, 96.29it/s]\n"
     ]
    }
   ],
   "source": [
    "for i in tqdm(range(100)):\n",
    "    time.sleep(0.01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "14f2c6c6-21a6-4fd6-a114-65913e3bbc89",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Обработка строк: 100%|█████████████████████████████████████████████████████| 4/4 [00:02<00:00,  1.99it/s]\n"
     ]
    }
   ],
   "source": [
    "for index, row in tqdm(df.iterrows(), total=len(df), desc=\"Обработка строк\"):\n",
    "    time.sleep(0.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "557b51fe-d078-4923-ad30-d77ed464709c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "df = pd.read_csv(\"Students_Grading_Dataset.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "03649d1c-3638-429c-9bc1-415227b36e7c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 5000 entries, 0 to 4999\n",
      "Data columns (total 23 columns):\n",
      " #   Column                      Non-Null Count  Dtype  \n",
      "---  ------                      --------------  -----  \n",
      " 0   Student_ID                  5000 non-null   object \n",
      " 1   First_Name                  5000 non-null   object \n",
      " 2   Last_Name                   5000 non-null   object \n",
      " 3   Email                       5000 non-null   object \n",
      " 4   Gender                      5000 non-null   object \n",
      " 5   Age                         5000 non-null   int64  \n",
      " 6   Department                  5000 non-null   object \n",
      " 7   Attendance (%)              4484 non-null   float64\n",
      " 8   Midterm_Score               5000 non-null   float64\n",
      " 9   Final_Score                 5000 non-null   float64\n",
      " 10  Assignments_Avg             4483 non-null   float64\n",
      " 11  Quizzes_Avg                 5000 non-null   float64\n",
      " 12  Participation_Score         5000 non-null   float64\n",
      " 13  Projects_Score              5000 non-null   float64\n",
      " 14  Total_Score                 5000 non-null   float64\n",
      " 15  Grade                       5000 non-null   object \n",
      " 16  Study_Hours_per_Week        5000 non-null   float64\n",
      " 17  Extracurricular_Activities  5000 non-null   object \n",
      " 18  Internet_Access_at_Home     5000 non-null   object \n",
      " 19  Parent_Education_Level      3206 non-null   object \n",
      " 20  Family_Income_Level         5000 non-null   object \n",
      " 21  Stress_Level (1-10)         5000 non-null   int64  \n",
      " 22  Sleep_Hours_per_Night       5000 non-null   float64\n",
      "dtypes: float64(10), int64(2), object(11)\n",
      "memory usage: 898.6+ KB\n",
      "Общая информация None\n",
      "Описание числовых столбцов                Age  Attendance (%)  Midterm_Score  Final_Score  \\\n",
      "count  5000.000000     4484.000000    5000.000000  5000.000000   \n",
      "mean     21.048400       75.431409      70.326844    69.640788   \n",
      "std       1.989786       14.372446      17.213209    17.238744   \n",
      "min      18.000000       50.010000      40.000000    40.000000   \n",
      "25%      19.000000       63.265000      55.457500    54.667500   \n",
      "50%      21.000000       75.725000      70.510000    69.735000   \n",
      "75%      23.000000       87.472500      84.970000    84.500000   \n",
      "max      24.000000      100.000000      99.980000    99.980000   \n",
      "\n",
      "       Assignments_Avg  Quizzes_Avg  Participation_Score  Projects_Score  \\\n",
      "count      4483.000000  5000.000000          5000.000000     5000.000000   \n",
      "mean         74.798673    74.910728             4.980024       74.924860   \n",
      "std          14.411799    14.504281             2.890136       14.423415   \n",
      "min          50.000000    50.030000             0.000000       50.010000   \n",
      "25%          62.090000    62.490000             2.440000       62.320000   \n",
      "50%          74.810000    74.695000             4.955000       74.980000   \n",
      "75%          86.970000    87.630000             7.500000       87.367500   \n",
      "max          99.980000    99.960000            10.000000      100.000000   \n",
      "\n",
      "       Total_Score  Study_Hours_per_Week  Stress_Level (1-10)  \\\n",
      "count  5000.000000           5000.000000           5000.00000   \n",
      "mean     75.121804             17.658860              5.48080   \n",
      "std      14.399941              7.275864              2.86155   \n",
      "min      50.020000              5.000000              1.00000   \n",
      "25%      62.835000             11.400000              3.00000   \n",
      "50%      75.395000             17.500000              5.00000   \n",
      "75%      87.652500             24.100000              8.00000   \n",
      "max      99.990000             30.000000             10.00000   \n",
      "\n",
      "       Sleep_Hours_per_Night  \n",
      "count            5000.000000  \n",
      "mean                6.488140  \n",
      "std                 1.452283  \n",
      "min                 4.000000  \n",
      "25%                 5.200000  \n",
      "50%                 6.500000  \n",
      "75%                 7.700000  \n",
      "max                 9.000000  \n"
     ]
    }
   ],
   "source": [
    "print(f\"Общая информация {df.info()}\")\n",
    "print(f\"Описание числовых столбцов {df.describe()}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "f3d1c477-4bb0-4f37-b65d-a683f5b88940",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25120 characters]",
      "text/plain": [
       "<Figure size 600x400 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(6,4))\n",
    "sns.histplot(df[\"Total_Score\"], bins=20, kde=True, color=\"blue\")\n",
    "plt.title(\"Распределение итоговых баллов\")\n",
    "plt.xlabel(\"Баллы\")\n",
    "plt.ylabel(\"Частота\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "d00fdf41-fd21-41d4-93f7-4417b59c0495",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 394660 characters]",
      "text/plain": [
       "<Figure size 600x400 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(6,4))\n",
    "sns.scatterplot(x=df[\"Study_Hours_per_Week\"], y=df[\"Total_Score\"], hue=df[\"Grade\"])\n",
    "plt.title(\"Влияние времени учебы на итоговый балл\")\n",
    "plt.xlabel(\"Часы учебы в неделю\")\n",
    "plt.ylabel(\"Итоговый балл\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "65085a93-8a6a-4e60-ab92-662f43f12ff2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 22020 characters]",
      "text/plain": [
       "<Figure size 600x400 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(6,4))\n",
    "sns.boxplot(x=\"Stress_Level (1-10)\", y=\"Total_Score\", data=df)\n",
    "plt.title(\"Связь уровня стресса и итогового балла\")\n",
    "plt.xlabel(\"Уровень стресса\")\n",
    "plt.ylabel(\"Итоговый балл\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "adfa80f5-20af-4e0f-95e4-31f425ff4298",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
