Добавили все файлы

This commit is contained in:
2026-05-07 16:38:13 +03:00
commit 41cbaf4130
9 changed files with 1070 additions and 0 deletions
+250
View File
@@ -0,0 +1,250 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "75d19e99-7e7a-47f6-9e31-537e645d8f3c",
"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.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 str \n",
" 1 Возраст 4 non-null int64\n",
" 2 Баллы 4 non-null int64\n",
"dtypes: int64(2), str(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": "code",
"execution_count": 2,
"id": "5d78faf3-86e3-4af2-938a-9c49db11ca0b",
"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>Имя</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": [
"df"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "1bc4b60e-2c46-4cf7-8da7-08770555c62f",
"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>Имя</th>\n",
" <th>Возраст</th>\n",
" <th>Баллы</th>\n",
" <th>Новый столбец</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Борис</td>\n",
" <td>22</td>\n",
" <td>76</td>\n",
" <td>83.6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Виктор</td>\n",
" <td>23</td>\n",
" <td>95</td>\n",
" <td>104.5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Галина</td>\n",
" <td>24</td>\n",
" <td>82</td>\n",
" <td>90.2</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Имя Возраст Баллы Новый столбец\n",
"1 Борис 22 76 83.6\n",
"2 Виктор 23 95 104.5\n",
"3 Галина 24 82 90.2"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df[\"Новый столбец\"] = df[\"Баллы\"] * 1.1\n",
"df\n",
"df.groupby(\"Имя\").agg({\"Баллы\": \"mean\"})\n",
"df[df[\"Возраст\"] > 21]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "306c6886-f00d-4317-ad69-f4d9f11220a4",
"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.14.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
+86
View File
@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "fcb09a3f-8f09-442f-9dc0-05087980216c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Матрица 2x3:\n",
" [[1 2 3]\n",
" [4 5 6]]\n",
"Форма (shape): (2, 3)\n",
"------------------------------\n",
"Равномерная шкала (linspace):\n",
" [0. 0.55555556 1.11111111 1.66666667 2.22222222 2.77777778\n",
" 3.33333333 3.88888889 4.44444444 5. ]\n",
"------------------------------\n",
"Случайная матрица 2x2:\n",
" [[-0.95758367 0.58589362]\n",
" [-0.25530405 1.71658099]]\n",
"------------------------------\n",
"Результат матричного умножения A и B:\n",
" [[19 22]\n",
" [43 50]]\n",
"------------------------------\n",
"Сумма по столбцам матрицы: [5 7 9]\n",
"Среднее по строкам матрицы: [2. 5.]\n"
]
}
],
"source": [
"import numpy as np\n",
"matrix = np.array([[1, 2, 3], [4, 5, 6]])\n",
"print(\"Матрица 2x3:\\n\", matrix)\n",
"print(\"Форма (shape):\", matrix.shape)\n",
"print(\"-\" * 30)\n",
"linear_space = np.linspace(0, 5, 10)\n",
"print(\"Равномерная шкала (linspace):\\n\", linear_space)\n",
"print(\"-\" * 30)\n",
"random_matrix = np.random.randn(2, 2)\n",
"print(\"Случайная матрица 2x2:\\n\", random_matrix)\n",
"print(\"-\" * 30)\n",
"A = np.array([[1, 2], [3, 4]])\n",
"B = np.array([[5, 6], [7, 8]])\n",
"dot_product = np.dot(A, B)\n",
"print(\"Результат матричного умножения A и B:\\n\", dot_product)\n",
"print(\"-\" * 30)\n",
"print(\"Сумма по столбцам матрицы:\", matrix.sum(axis=0))\n",
"print(\"Среднее по строкам матрицы:\", matrix.mean(axis=1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1d0670c4-4ce2-4024-b803-456646dbb94f",
"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.14.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
File diff suppressed because one or more lines are too long
+110
View File
@@ -0,0 +1,110 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"id": "f3b57c0d-557d-41fd-9dcb-5bd23450d4d1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"========== ЭТАП 1: ОБРАБОТКА ==========\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4ba14952aa5b44cab19264f1070e2952",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Анализ строк: 0%| | 0/100 [00:00<?, ?строк/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"======================================\n",
"\n",
"========== ЭТАП 2: НЕЙРОСЕТЬ ==========\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3e5da2b4604645d18fa78063105cbc7a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Загрузка весов: 0%| | 0/100 [00:00<?, ? слоев/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"from tqdm.auto import tqdm \n",
"import time\n",
"\n",
"df = pd.DataFrame({\n",
" 'ID': range(1, 101),\n",
" 'Data': np.random.randn(100)\n",
"})\n",
"\n",
"print(f\"{'='*10} ЭТАП 1: ОБРАБОТКА {'='*10}\")\n",
"# Использование tqdm напрямую для итерации по строкам\n",
"for _ in tqdm(df.values, desc=\"Анализ строк\", unit=\"строк\"):\n",
" time.sleep(0.01) # Ускорил для теста\n",
"\n",
"print(\"\\n\" + \"=\"*38 + \"\\n\")\n",
"print(f\"{'='*10} ЭТАП 2: НЕЙРОСЕТЬ {'='*10}\")\n",
"for i in tqdm(range(100), \n",
" desc='Загрузка весов', \n",
" unit=' слоев', \n",
" colour='green'):\n",
" time.sleep(0.02)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fdc92940-7e90-4489-948f-0141f7441baa",
"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.14.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+26
View File
@@ -0,0 +1,26 @@
title,popularity,vote_average,vote_count,release_year
Евгений Онегин,95.2,9.8,15000,1833
Герой нашего времени,88.4,9.5,12000,1840
Война и мир,120.1,9.7,18000,1869
Преступление и наказание,110.5,9.6,17500,1866
Мертвые души,75.3,9.2,10500,1842
Отцы и дети,65.8,8.8,9000,1862
Анна Каренина,105.2,9.4,14000,1877
Идиот,92.7,9.3,13000,1868
Капитанская дочка,55.4,8.9,8500,1836
Шинель,45.1,8.7,7000,1842
Братья Карамазовы,115.8,9.8,16000,1880
Ревизор,70.2,9.1,9500,1836
Руслан и Людмила,40.5,8.5,6000,1820
Обломов,58.9,8.6,8200,1859
Горе от ума,62.4,9.0,8800,1825
Демон,35.7,8.8,5400,1839
Муму,30.2,8.2,4500,1854
Бедные люди,25.4,8.4,3800,1846
Гроза,48.6,8.3,7200,1859
Левша,32.1,8.5,5100,1881
Нос,42.8,8.9,6800,1836
Пиковая дама,50.3,9.1,7400,1834
Вишневый сад,82.5,9.2,11000,1903
Борис Годунов,44.2,8.7,5900,1831
Бесприданница,38.9,8.4,6100,1878
1 title popularity vote_average vote_count release_year
2 Евгений Онегин 95.2 9.8 15000 1833
3 Герой нашего времени 88.4 9.5 12000 1840
4 Война и мир 120.1 9.7 18000 1869
5 Преступление и наказание 110.5 9.6 17500 1866
6 Мертвые души 75.3 9.2 10500 1842
7 Отцы и дети 65.8 8.8 9000 1862
8 Анна Каренина 105.2 9.4 14000 1877
9 Идиот 92.7 9.3 13000 1868
10 Капитанская дочка 55.4 8.9 8500 1836
11 Шинель 45.1 8.7 7000 1842
12 Братья Карамазовы 115.8 9.8 16000 1880
13 Ревизор 70.2 9.1 9500 1836
14 Руслан и Людмила 40.5 8.5 6000 1820
15 Обломов 58.9 8.6 8200 1859
16 Горе от ума 62.4 9.0 8800 1825
17 Демон 35.7 8.8 5400 1839
18 Муму 30.2 8.2 4500 1854
19 Бедные люди 25.4 8.4 3800 1846
20 Гроза 48.6 8.3 7200 1859
21 Левша 32.1 8.5 5100 1881
22 Нос 42.8 8.9 6800 1836
23 Пиковая дама 50.3 9.1 7400 1834
24 Вишневый сад 82.5 9.2 11000 1903
25 Борис Годунов 44.2 8.7 5900 1831
26 Бесприданница 38.9 8.4 6100 1878