From fbf0f82b342371838cb853f387d0220998cc45d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=D0=B0=20=D0=9A=D0=BE=D0=BF?= =?UTF-8?q?=D1=8B=D0=BB=D0=BE=D0=B2?= Date: Sun, 18 May 2025 15:22:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=81=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 + week2_analysis.ipynb | 318 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 321 insertions(+) create mode 100644 .gitignore create mode 100644 week2_analysis.ipynb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..df2084b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +.venv +.ipynb_checkpoints \ No newline at end of file diff --git a/week2_analysis.ipynb b/week2_analysis.ipynb new file mode 100644 index 0000000..8019d05 --- /dev/null +++ b/week2_analysis.ipynb @@ -0,0 +1,318 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "43d948e5-c6ab-49bc-af02-cce09d448c0a", + "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", + "\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": [ + "import pandas as pd\n", + "\n", + "# Создадим DataFrame\n", + "data = {\n", + " \"Имя\": [\"Анна\", \"Борис\", \"Виктор\", \"Галина\"],\n", + " \"Возраст\": [21, 22, 23, 24],\n", + " \"Баллы\": [89, 76, 95, 82]\n", + "}\n", + "df = pd.DataFrame(data)\n", + "\n", + "print(\"Первый взгляд на данные:\")\n", + "print(df.head())\n", + "print(df.info())\n", + "print(df.describe())\n", + "print(df.isnull().sum())" + ] + }, + { + "cell_type": "markdown", + "id": "22288d55-04b9-4e80-8120-2da41b1a32b0", + "metadata": {}, + "source": [ + "стандартный код, без изменений" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "4d8c96fc-1e83-4218-a96b-81575c28f0d7", + "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", + "\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" + ] + }, + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ИмяВозрастБаллы
0Анна2189
1Борис2276
2Виктор2395
3Галина2482
\n", + "
" + ], + "text/plain": [ + " Имя Возраст Баллы\n", + "0 Анна 21 89\n", + "1 Борис 22 76\n", + "2 Виктор 23 95\n", + "3 Галина 24 82" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "\n", + "# Создадим DataFrame\n", + "data = {\n", + " \"Имя\": [\"Анна\", \"Борис\", \"Виктор\", \"Галина\"],\n", + " \"Возраст\": [21, 22, 23, 24],\n", + " \"Баллы\": [89, 76, 95, 82]\n", + "}\n", + "df = pd.DataFrame(data)\n", + "\n", + "print(\"Первый взгляд на данные:\")\n", + "print(df.head())\n", + "print(df.info())\n", + "print(df.describe())\n", + "print(df.isnull().sum())\n", + "df" + ] + }, + { + "cell_type": "markdown", + "id": "e2b6ea08-81e6-4e0d-a9b6-be6559349c7e", + "metadata": {}, + "source": [ + "добавил df в конце кода" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "b1361266-d103-4766-9337-c9afe7c1873f", + "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", + "\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", + " Имя Возраст Баллы Баллы с коэффициентом\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" + ] + } + ], + "source": [ + "import pandas as pd\n", + "\n", + "# Создадим DataFrame\n", + "data = {\n", + " \"Имя\": [\"Анна\", \"Борис\", \"Виктор\", \"Галина\"],\n", + " \"Возраст\": [21, 22, 23, 24],\n", + " \"Баллы\": [89, 76, 95, 82]\n", + "}\n", + "df = pd.DataFrame(data)\n", + "\n", + "print(\"Первый взгляд на данные:\")\n", + "print(df.head())\n", + "print(df.info())\n", + "print(df.describe())\n", + "print(df.isnull().sum())\n", + "\n", + "# Добавляем новый столбец с вычисляемыми значениями\n", + "df[\"Баллы с коэффициентом\"] = df[\"Баллы\"] * 1.1\n", + "\n", + "print(df)" + ] + }, + { + "cell_type": "markdown", + "id": "5d658850-1ef4-41cc-81c2-afda9213bd6d", + "metadata": {}, + "source": [ + "добавил новый столбец с вычисляемыми значениями" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d27ebb99-d8b7-44b6-9d6f-59062c18eb81", + "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.13.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}