добавил все файлы
This commit is contained in:
parent
0fb04191fe
commit
fbf0f82b34
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.idea
|
||||
.venv
|
||||
.ipynb_checkpoints
|
318
week2_analysis.ipynb
Normal file
318
week2_analysis.ipynb
Normal file
@ -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",
|
||||
"<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": [
|
||||
"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",
|
||||
"<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"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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>Имя</th>\n",
|
||||
" <th>Возраст</th>\n",
|
||||
" <th>Баллы</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>0</th>\n",
|
||||
" <td>Анна</td>\n",
|
||||
" <td>21</td>\n",
|
||||
" <td>89</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>1</th>\n",
|
||||
" <td>Борис</td>\n",
|
||||
" <td>22</td>\n",
|
||||
" <td>76</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>Виктор</td>\n",
|
||||
" <td>23</td>\n",
|
||||
" <td>95</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>Галина</td>\n",
|
||||
" <td>24</td>\n",
|
||||
" <td>82</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"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",
|
||||
"<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",
|
||||
" Имя Возраст Баллы Баллы с коэффициентом\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
|
||||
}
|
Loading…
Reference in New Issue
Block a user