2024-09-07 00:57:54 +04:00
|
|
|
|
{
|
|
|
|
|
"cells": [
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"# Лабораторная работа 1\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"Вариант - 9\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"Датасет - магазины\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"Поля \n",
|
|
|
|
|
"1. ID магазина\n",
|
|
|
|
|
"2. площадь магазина \n",
|
|
|
|
|
"3. количество разных товаров \n",
|
|
|
|
|
"4. количество покупателей\n",
|
|
|
|
|
"5. объем продаж"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Загрузка и сохранение данных"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 1,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"import pandas as pd\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"df = pd.read_csv(\"data/Stores.csv\")\n",
|
|
|
|
|
"df.to_csv(\"data/Stores_updated.csv\", index=False)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Получение сведений о датафрейме с данными"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"1. Общая информация о датафрейме"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 2,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|
|
|
|
"RangeIndex: 896 entries, 0 to 895\n",
|
|
|
|
|
"Data columns (total 5 columns):\n",
|
|
|
|
|
" # Column Non-Null Count Dtype\n",
|
|
|
|
|
"--- ------ -------------- -----\n",
|
|
|
|
|
" 0 Store ID 896 non-null int64\n",
|
|
|
|
|
" 1 Store_Area 896 non-null int64\n",
|
|
|
|
|
" 2 Items_Available 896 non-null int64\n",
|
|
|
|
|
" 3 Daily_Customer_Count 896 non-null int64\n",
|
|
|
|
|
" 4 Store_Sales 896 non-null int64\n",
|
|
|
|
|
"dtypes: int64(5)\n",
|
|
|
|
|
"memory usage: 35.1 KB\n"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df.info()"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"2. Статистическая информация"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 3,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store ID</th>\n",
|
|
|
|
|
" <th>Store_Area</th>\n",
|
|
|
|
|
" <th>Items_Available</th>\n",
|
|
|
|
|
" <th>Daily_Customer_Count</th>\n",
|
|
|
|
|
" <th>Store_Sales</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>count</th>\n",
|
|
|
|
|
" <td>896.000000</td>\n",
|
|
|
|
|
" <td>896.000000</td>\n",
|
|
|
|
|
" <td>896.000000</td>\n",
|
|
|
|
|
" <td>896.000000</td>\n",
|
|
|
|
|
" <td>896.000000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>mean</th>\n",
|
|
|
|
|
" <td>448.500000</td>\n",
|
|
|
|
|
" <td>1485.409598</td>\n",
|
|
|
|
|
" <td>1782.035714</td>\n",
|
|
|
|
|
" <td>786.350446</td>\n",
|
|
|
|
|
" <td>59351.305804</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>std</th>\n",
|
|
|
|
|
" <td>258.797218</td>\n",
|
|
|
|
|
" <td>250.237011</td>\n",
|
|
|
|
|
" <td>299.872053</td>\n",
|
|
|
|
|
" <td>265.389281</td>\n",
|
|
|
|
|
" <td>17190.741895</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>min</th>\n",
|
|
|
|
|
" <td>1.000000</td>\n",
|
|
|
|
|
" <td>775.000000</td>\n",
|
|
|
|
|
" <td>932.000000</td>\n",
|
|
|
|
|
" <td>10.000000</td>\n",
|
|
|
|
|
" <td>14920.000000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>25%</th>\n",
|
|
|
|
|
" <td>224.750000</td>\n",
|
|
|
|
|
" <td>1316.750000</td>\n",
|
|
|
|
|
" <td>1575.500000</td>\n",
|
|
|
|
|
" <td>600.000000</td>\n",
|
|
|
|
|
" <td>46530.000000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>50%</th>\n",
|
|
|
|
|
" <td>448.500000</td>\n",
|
|
|
|
|
" <td>1477.000000</td>\n",
|
|
|
|
|
" <td>1773.500000</td>\n",
|
|
|
|
|
" <td>780.000000</td>\n",
|
|
|
|
|
" <td>58605.000000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>75%</th>\n",
|
|
|
|
|
" <td>672.250000</td>\n",
|
|
|
|
|
" <td>1653.500000</td>\n",
|
|
|
|
|
" <td>1982.750000</td>\n",
|
|
|
|
|
" <td>970.000000</td>\n",
|
|
|
|
|
" <td>71872.500000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>max</th>\n",
|
|
|
|
|
" <td>896.000000</td>\n",
|
|
|
|
|
" <td>2229.000000</td>\n",
|
|
|
|
|
" <td>2667.000000</td>\n",
|
|
|
|
|
" <td>1560.000000</td>\n",
|
|
|
|
|
" <td>116320.000000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Store ID Store_Area Items_Available Daily_Customer_Count \\\n",
|
|
|
|
|
"count 896.000000 896.000000 896.000000 896.000000 \n",
|
|
|
|
|
"mean 448.500000 1485.409598 1782.035714 786.350446 \n",
|
|
|
|
|
"std 258.797218 250.237011 299.872053 265.389281 \n",
|
|
|
|
|
"min 1.000000 775.000000 932.000000 10.000000 \n",
|
|
|
|
|
"25% 224.750000 1316.750000 1575.500000 600.000000 \n",
|
|
|
|
|
"50% 448.500000 1477.000000 1773.500000 780.000000 \n",
|
|
|
|
|
"75% 672.250000 1653.500000 1982.750000 970.000000 \n",
|
|
|
|
|
"max 896.000000 2229.000000 2667.000000 1560.000000 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Store_Sales \n",
|
|
|
|
|
"count 896.000000 \n",
|
|
|
|
|
"mean 59351.305804 \n",
|
|
|
|
|
"std 17190.741895 \n",
|
|
|
|
|
"min 14920.000000 \n",
|
|
|
|
|
"25% 46530.000000 \n",
|
|
|
|
|
"50% 58605.000000 \n",
|
|
|
|
|
"75% 71872.500000 \n",
|
|
|
|
|
"max 116320.000000 "
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 3,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"df.describe()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Получение сведений о колонках датафрейма"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"1. Названия колонок"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 4,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"Index(['Store ID ', 'Store_Area', 'Items_Available', 'Daily_Customer_Count',\n",
|
|
|
|
|
" 'Store_Sales'],\n",
|
|
|
|
|
" dtype='object')"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 4,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df.columns"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"Вывод отдельных строк и столбцов"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"1. Столбец \"Store_Area\""
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 5,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store_Area</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1659</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>1461</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>1340</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>1451</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>1770</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>891</th>\n",
|
|
|
|
|
" <td>1582</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>892</th>\n",
|
|
|
|
|
" <td>1387</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>893</th>\n",
|
|
|
|
|
" <td>1200</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>894</th>\n",
|
|
|
|
|
" <td>1299</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>895</th>\n",
|
|
|
|
|
" <td>1174</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 1 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Store_Area\n",
|
|
|
|
|
"0 1659\n",
|
|
|
|
|
"1 1461\n",
|
|
|
|
|
"2 1340\n",
|
|
|
|
|
"3 1451\n",
|
|
|
|
|
"4 1770\n",
|
|
|
|
|
".. ...\n",
|
|
|
|
|
"891 1582\n",
|
|
|
|
|
"892 1387\n",
|
|
|
|
|
"893 1200\n",
|
|
|
|
|
"894 1299\n",
|
|
|
|
|
"895 1174\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 1 columns]"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 5,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df[[\"Store_Area\"]]"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"2. Несколько столбцокв"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 6,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store ID</th>\n",
|
|
|
|
|
" <th>Store_Sales</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>66490</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>39820</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>3</td>\n",
|
|
|
|
|
" <td>54010</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>53730</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>46620</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>891</th>\n",
|
|
|
|
|
" <td>892</td>\n",
|
|
|
|
|
" <td>66390</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>892</th>\n",
|
|
|
|
|
" <td>893</td>\n",
|
|
|
|
|
" <td>82080</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>893</th>\n",
|
|
|
|
|
" <td>894</td>\n",
|
|
|
|
|
" <td>76440</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>894</th>\n",
|
|
|
|
|
" <td>895</td>\n",
|
|
|
|
|
" <td>96610</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>895</th>\n",
|
|
|
|
|
" <td>896</td>\n",
|
|
|
|
|
" <td>54340</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 2 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Store ID Store_Sales\n",
|
|
|
|
|
"0 1 66490\n",
|
|
|
|
|
"1 2 39820\n",
|
|
|
|
|
"2 3 54010\n",
|
|
|
|
|
"3 4 53730\n",
|
|
|
|
|
"4 5 46620\n",
|
|
|
|
|
".. ... ...\n",
|
|
|
|
|
"891 892 66390\n",
|
|
|
|
|
"892 893 82080\n",
|
|
|
|
|
"893 894 76440\n",
|
|
|
|
|
"894 895 96610\n",
|
|
|
|
|
"895 896 54340\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 2 columns]"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 6,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df[[\"Store ID \", \"Store_Sales\"]]"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"3. Первая строка"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 7,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store ID</th>\n",
|
|
|
|
|
" <th>Store_Area</th>\n",
|
|
|
|
|
" <th>Items_Available</th>\n",
|
|
|
|
|
" <th>Daily_Customer_Count</th>\n",
|
|
|
|
|
" <th>Store_Sales</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>1659</td>\n",
|
|
|
|
|
" <td>1961</td>\n",
|
|
|
|
|
" <td>530</td>\n",
|
|
|
|
|
" <td>66490</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Store ID Store_Area Items_Available Daily_Customer_Count Store_Sales\n",
|
|
|
|
|
"0 1 1659 1961 530 66490"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 7,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df.iloc[[0]]"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"4. Вывод по условию"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 8,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store ID</th>\n",
|
|
|
|
|
" <th>Store_Area</th>\n",
|
|
|
|
|
" <th>Items_Available</th>\n",
|
|
|
|
|
" <th>Daily_Customer_Count</th>\n",
|
|
|
|
|
" <th>Store_Sales</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>1659</td>\n",
|
|
|
|
|
" <td>1961</td>\n",
|
|
|
|
|
" <td>530</td>\n",
|
|
|
|
|
" <td>66490</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>1461</td>\n",
|
|
|
|
|
" <td>1752</td>\n",
|
|
|
|
|
" <td>210</td>\n",
|
|
|
|
|
" <td>39820</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>3</td>\n",
|
|
|
|
|
" <td>1340</td>\n",
|
|
|
|
|
" <td>1609</td>\n",
|
|
|
|
|
" <td>720</td>\n",
|
|
|
|
|
" <td>54010</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>1451</td>\n",
|
|
|
|
|
" <td>1748</td>\n",
|
|
|
|
|
" <td>620</td>\n",
|
|
|
|
|
" <td>53730</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>1770</td>\n",
|
|
|
|
|
" <td>2111</td>\n",
|
|
|
|
|
" <td>450</td>\n",
|
|
|
|
|
" <td>46620</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>891</th>\n",
|
|
|
|
|
" <td>892</td>\n",
|
|
|
|
|
" <td>1582</td>\n",
|
|
|
|
|
" <td>1910</td>\n",
|
|
|
|
|
" <td>1080</td>\n",
|
|
|
|
|
" <td>66390</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>892</th>\n",
|
|
|
|
|
" <td>893</td>\n",
|
|
|
|
|
" <td>1387</td>\n",
|
|
|
|
|
" <td>1663</td>\n",
|
|
|
|
|
" <td>850</td>\n",
|
|
|
|
|
" <td>82080</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>893</th>\n",
|
|
|
|
|
" <td>894</td>\n",
|
|
|
|
|
" <td>1200</td>\n",
|
|
|
|
|
" <td>1436</td>\n",
|
|
|
|
|
" <td>1060</td>\n",
|
|
|
|
|
" <td>76440</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>894</th>\n",
|
|
|
|
|
" <td>895</td>\n",
|
|
|
|
|
" <td>1299</td>\n",
|
|
|
|
|
" <td>1560</td>\n",
|
|
|
|
|
" <td>770</td>\n",
|
|
|
|
|
" <td>96610</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>895</th>\n",
|
|
|
|
|
" <td>896</td>\n",
|
|
|
|
|
" <td>1174</td>\n",
|
|
|
|
|
" <td>1429</td>\n",
|
|
|
|
|
" <td>1110</td>\n",
|
|
|
|
|
" <td>54340</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 5 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Store ID Store_Area Items_Available Daily_Customer_Count Store_Sales\n",
|
|
|
|
|
"0 1 1659 1961 530 66490\n",
|
|
|
|
|
"1 2 1461 1752 210 39820\n",
|
|
|
|
|
"2 3 1340 1609 720 54010\n",
|
|
|
|
|
"3 4 1451 1748 620 53730\n",
|
|
|
|
|
"4 5 1770 2111 450 46620\n",
|
|
|
|
|
".. ... ... ... ... ...\n",
|
|
|
|
|
"891 892 1582 1910 1080 66390\n",
|
|
|
|
|
"892 893 1387 1663 850 82080\n",
|
|
|
|
|
"893 894 1200 1436 1060 76440\n",
|
|
|
|
|
"894 895 1299 1560 770 96610\n",
|
|
|
|
|
"895 896 1174 1429 1110 54340\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 5 columns]"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 8,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df[df[\"Store_Sales\"] > 2000]"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"Группировка и агрегация данных"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"1. Средняя продажа по каждому магазину"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 9,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store_Sales</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>Store ID</th>\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>66490.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>39820.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>54010.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>53730.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>5</th>\n",
|
|
|
|
|
" <td>46620.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>892</th>\n",
|
|
|
|
|
" <td>66390.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>893</th>\n",
|
|
|
|
|
" <td>82080.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>894</th>\n",
|
|
|
|
|
" <td>76440.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>895</th>\n",
|
|
|
|
|
" <td>96610.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>896</th>\n",
|
|
|
|
|
" <td>54340.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 1 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Store_Sales\n",
|
|
|
|
|
"Store ID \n",
|
|
|
|
|
"1 66490.0\n",
|
|
|
|
|
"2 39820.0\n",
|
|
|
|
|
"3 54010.0\n",
|
|
|
|
|
"4 53730.0\n",
|
|
|
|
|
"5 46620.0\n",
|
|
|
|
|
"... ...\n",
|
|
|
|
|
"892 66390.0\n",
|
|
|
|
|
"893 82080.0\n",
|
|
|
|
|
"894 76440.0\n",
|
|
|
|
|
"895 96610.0\n",
|
|
|
|
|
"896 54340.0\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 1 columns]"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 9,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"df.groupby([\"Store ID \"])[[\"Store_Sales\"]].mean()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"2. Для каждого магазина общая сумма продаж и среднее количество посетителей"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 10,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
2024-09-07 00:57:54 +04:00
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store_Sales</th>\n",
|
|
|
|
|
" <th>Daily_Customer_Count</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>Store ID</th>\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>66490</td>\n",
|
|
|
|
|
" <td>530.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>39820</td>\n",
|
|
|
|
|
" <td>210.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>54010</td>\n",
|
|
|
|
|
" <td>720.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>53730</td>\n",
|
|
|
|
|
" <td>620.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>5</th>\n",
|
|
|
|
|
" <td>46620</td>\n",
|
|
|
|
|
" <td>450.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>892</th>\n",
|
|
|
|
|
" <td>66390</td>\n",
|
|
|
|
|
" <td>1080.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>893</th>\n",
|
|
|
|
|
" <td>82080</td>\n",
|
|
|
|
|
" <td>850.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>894</th>\n",
|
|
|
|
|
" <td>76440</td>\n",
|
|
|
|
|
" <td>1060.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>895</th>\n",
|
|
|
|
|
" <td>96610</td>\n",
|
|
|
|
|
" <td>770.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>896</th>\n",
|
|
|
|
|
" <td>54340</td>\n",
|
|
|
|
|
" <td>1110.0</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 2 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
" Store_Sales Daily_Customer_Count\n",
|
|
|
|
|
"Store ID \n",
|
|
|
|
|
"1 66490 530.0\n",
|
|
|
|
|
"2 39820 210.0\n",
|
|
|
|
|
"3 54010 720.0\n",
|
|
|
|
|
"4 53730 620.0\n",
|
|
|
|
|
"5 46620 450.0\n",
|
|
|
|
|
"... ... ...\n",
|
|
|
|
|
"892 66390 1080.0\n",
|
|
|
|
|
"893 82080 850.0\n",
|
|
|
|
|
"894 76440 1060.0\n",
|
|
|
|
|
"895 96610 770.0\n",
|
|
|
|
|
"896 54340 1110.0\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 2 columns]"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 10,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
2024-09-20 23:45:27 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"df.groupby(\"Store ID \").agg({\"Store_Sales\": \"sum\", \"Daily_Customer_Count\": \"mean\"})"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Сортировка данных"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"1. Сортировка по продажам по убыванию"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 11,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
2024-09-07 00:57:54 +04:00
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store ID</th>\n",
|
|
|
|
|
" <th>Store_Area</th>\n",
|
|
|
|
|
" <th>Items_Available</th>\n",
|
|
|
|
|
" <th>Daily_Customer_Count</th>\n",
|
|
|
|
|
" <th>Store_Sales</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>649</th>\n",
|
|
|
|
|
" <td>650</td>\n",
|
|
|
|
|
" <td>1989</td>\n",
|
|
|
|
|
" <td>2414</td>\n",
|
|
|
|
|
" <td>860</td>\n",
|
|
|
|
|
" <td>116320</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>868</th>\n",
|
|
|
|
|
" <td>869</td>\n",
|
|
|
|
|
" <td>1775</td>\n",
|
|
|
|
|
" <td>2104</td>\n",
|
|
|
|
|
" <td>980</td>\n",
|
|
|
|
|
" <td>105150</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>432</th>\n",
|
|
|
|
|
" <td>433</td>\n",
|
|
|
|
|
" <td>1365</td>\n",
|
|
|
|
|
" <td>1638</td>\n",
|
|
|
|
|
" <td>680</td>\n",
|
|
|
|
|
" <td>102920</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>408</th>\n",
|
|
|
|
|
" <td>409</td>\n",
|
|
|
|
|
" <td>1303</td>\n",
|
|
|
|
|
" <td>1587</td>\n",
|
|
|
|
|
" <td>1310</td>\n",
|
|
|
|
|
" <td>102310</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>758</th>\n",
|
|
|
|
|
" <td>759</td>\n",
|
|
|
|
|
" <td>1486</td>\n",
|
|
|
|
|
" <td>1758</td>\n",
|
|
|
|
|
" <td>820</td>\n",
|
|
|
|
|
" <td>101820</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>352</th>\n",
|
|
|
|
|
" <td>353</td>\n",
|
|
|
|
|
" <td>1397</td>\n",
|
|
|
|
|
" <td>1686</td>\n",
|
|
|
|
|
" <td>850</td>\n",
|
|
|
|
|
" <td>21300</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>593</th>\n",
|
|
|
|
|
" <td>594</td>\n",
|
|
|
|
|
" <td>1624</td>\n",
|
|
|
|
|
" <td>1946</td>\n",
|
|
|
|
|
" <td>870</td>\n",
|
|
|
|
|
" <td>20270</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>775</th>\n",
|
|
|
|
|
" <td>776</td>\n",
|
|
|
|
|
" <td>1537</td>\n",
|
|
|
|
|
" <td>1877</td>\n",
|
|
|
|
|
" <td>660</td>\n",
|
|
|
|
|
" <td>17670</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>852</th>\n",
|
|
|
|
|
" <td>853</td>\n",
|
|
|
|
|
" <td>1477</td>\n",
|
|
|
|
|
" <td>1790</td>\n",
|
|
|
|
|
" <td>880</td>\n",
|
|
|
|
|
" <td>16370</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>31</th>\n",
|
|
|
|
|
" <td>32</td>\n",
|
|
|
|
|
" <td>1250</td>\n",
|
|
|
|
|
" <td>1508</td>\n",
|
|
|
|
|
" <td>990</td>\n",
|
|
|
|
|
" <td>14920</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 5 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
" Store ID Store_Area Items_Available Daily_Customer_Count Store_Sales\n",
|
|
|
|
|
"649 650 1989 2414 860 116320\n",
|
|
|
|
|
"868 869 1775 2104 980 105150\n",
|
|
|
|
|
"432 433 1365 1638 680 102920\n",
|
|
|
|
|
"408 409 1303 1587 1310 102310\n",
|
|
|
|
|
"758 759 1486 1758 820 101820\n",
|
|
|
|
|
".. ... ... ... ... ...\n",
|
|
|
|
|
"352 353 1397 1686 850 21300\n",
|
|
|
|
|
"593 594 1624 1946 870 20270\n",
|
|
|
|
|
"775 776 1537 1877 660 17670\n",
|
|
|
|
|
"852 853 1477 1790 880 16370\n",
|
|
|
|
|
"31 32 1250 1508 990 14920\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 5 columns]"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 11,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"output_type": "execute_result"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df.sort_values(\"Store_Sales\", ascending=False)"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"2. Сортировка по нескольким столбцам"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 12,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store ID</th>\n",
|
|
|
|
|
" <th>Store_Area</th>\n",
|
|
|
|
|
" <th>Items_Available</th>\n",
|
|
|
|
|
" <th>Daily_Customer_Count</th>\n",
|
|
|
|
|
" <th>Store_Sales</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>158</th>\n",
|
|
|
|
|
" <td>159</td>\n",
|
|
|
|
|
" <td>775</td>\n",
|
|
|
|
|
" <td>932</td>\n",
|
|
|
|
|
" <td>1090</td>\n",
|
|
|
|
|
" <td>42530</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>865</th>\n",
|
|
|
|
|
" <td>866</td>\n",
|
|
|
|
|
" <td>780</td>\n",
|
|
|
|
|
" <td>951</td>\n",
|
|
|
|
|
" <td>790</td>\n",
|
|
|
|
|
" <td>25600</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>744</th>\n",
|
|
|
|
|
" <td>745</td>\n",
|
|
|
|
|
" <td>854</td>\n",
|
|
|
|
|
" <td>1018</td>\n",
|
|
|
|
|
" <td>660</td>\n",
|
|
|
|
|
" <td>77740</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>549</th>\n",
|
|
|
|
|
" <td>550</td>\n",
|
|
|
|
|
" <td>869</td>\n",
|
|
|
|
|
" <td>1050</td>\n",
|
|
|
|
|
" <td>850</td>\n",
|
|
|
|
|
" <td>52540</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>72</th>\n",
|
|
|
|
|
" <td>73</td>\n",
|
|
|
|
|
" <td>891</td>\n",
|
|
|
|
|
" <td>1073</td>\n",
|
|
|
|
|
" <td>630</td>\n",
|
|
|
|
|
" <td>67370</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>398</th>\n",
|
|
|
|
|
" <td>399</td>\n",
|
|
|
|
|
" <td>2063</td>\n",
|
|
|
|
|
" <td>2493</td>\n",
|
|
|
|
|
" <td>810</td>\n",
|
|
|
|
|
" <td>51480</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>849</th>\n",
|
|
|
|
|
" <td>850</td>\n",
|
|
|
|
|
" <td>2067</td>\n",
|
|
|
|
|
" <td>2492</td>\n",
|
|
|
|
|
" <td>790</td>\n",
|
|
|
|
|
" <td>70230</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>91</th>\n",
|
|
|
|
|
" <td>92</td>\n",
|
|
|
|
|
" <td>2169</td>\n",
|
|
|
|
|
" <td>2617</td>\n",
|
|
|
|
|
" <td>600</td>\n",
|
|
|
|
|
" <td>67080</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>540</th>\n",
|
|
|
|
|
" <td>541</td>\n",
|
|
|
|
|
" <td>2214</td>\n",
|
|
|
|
|
" <td>2647</td>\n",
|
|
|
|
|
" <td>740</td>\n",
|
|
|
|
|
" <td>65900</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>466</th>\n",
|
|
|
|
|
" <td>467</td>\n",
|
|
|
|
|
" <td>2229</td>\n",
|
|
|
|
|
" <td>2667</td>\n",
|
|
|
|
|
" <td>660</td>\n",
|
|
|
|
|
" <td>87410</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 5 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
" Store ID Store_Area Items_Available Daily_Customer_Count Store_Sales\n",
|
|
|
|
|
"158 159 775 932 1090 42530\n",
|
|
|
|
|
"865 866 780 951 790 25600\n",
|
|
|
|
|
"744 745 854 1018 660 77740\n",
|
|
|
|
|
"549 550 869 1050 850 52540\n",
|
|
|
|
|
"72 73 891 1073 630 67370\n",
|
|
|
|
|
".. ... ... ... ... ...\n",
|
|
|
|
|
"398 399 2063 2493 810 51480\n",
|
|
|
|
|
"849 850 2067 2492 790 70230\n",
|
|
|
|
|
"91 92 2169 2617 600 67080\n",
|
|
|
|
|
"540 541 2214 2647 740 65900\n",
|
|
|
|
|
"466 467 2229 2667 660 87410\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 5 columns]"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 12,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
2024-09-20 23:45:27 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"df.sort_values([\"Store_Area\", \"Store_Sales\"], ascending=[True, False])"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Удаление строк/столбцов"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"1. Удаление столбца"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 13,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
2024-09-07 00:57:54 +04:00
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store ID</th>\n",
|
|
|
|
|
" <th>Items_Available</th>\n",
|
|
|
|
|
" <th>Daily_Customer_Count</th>\n",
|
|
|
|
|
" <th>Store_Sales</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>1961</td>\n",
|
|
|
|
|
" <td>530</td>\n",
|
|
|
|
|
" <td>66490</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>1752</td>\n",
|
|
|
|
|
" <td>210</td>\n",
|
|
|
|
|
" <td>39820</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>3</td>\n",
|
|
|
|
|
" <td>1609</td>\n",
|
|
|
|
|
" <td>720</td>\n",
|
|
|
|
|
" <td>54010</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>1748</td>\n",
|
|
|
|
|
" <td>620</td>\n",
|
|
|
|
|
" <td>53730</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>2111</td>\n",
|
|
|
|
|
" <td>450</td>\n",
|
|
|
|
|
" <td>46620</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>891</th>\n",
|
|
|
|
|
" <td>892</td>\n",
|
|
|
|
|
" <td>1910</td>\n",
|
|
|
|
|
" <td>1080</td>\n",
|
|
|
|
|
" <td>66390</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>892</th>\n",
|
|
|
|
|
" <td>893</td>\n",
|
|
|
|
|
" <td>1663</td>\n",
|
|
|
|
|
" <td>850</td>\n",
|
|
|
|
|
" <td>82080</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>893</th>\n",
|
|
|
|
|
" <td>894</td>\n",
|
|
|
|
|
" <td>1436</td>\n",
|
|
|
|
|
" <td>1060</td>\n",
|
|
|
|
|
" <td>76440</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>894</th>\n",
|
|
|
|
|
" <td>895</td>\n",
|
|
|
|
|
" <td>1560</td>\n",
|
|
|
|
|
" <td>770</td>\n",
|
|
|
|
|
" <td>96610</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>895</th>\n",
|
|
|
|
|
" <td>896</td>\n",
|
|
|
|
|
" <td>1429</td>\n",
|
|
|
|
|
" <td>1110</td>\n",
|
|
|
|
|
" <td>54340</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 4 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
" Store ID Items_Available Daily_Customer_Count Store_Sales\n",
|
|
|
|
|
"0 1 1961 530 66490\n",
|
|
|
|
|
"1 2 1752 210 39820\n",
|
|
|
|
|
"2 3 1609 720 54010\n",
|
|
|
|
|
"3 4 1748 620 53730\n",
|
|
|
|
|
"4 5 2111 450 46620\n",
|
|
|
|
|
".. ... ... ... ...\n",
|
|
|
|
|
"891 892 1910 1080 66390\n",
|
|
|
|
|
"892 893 1663 850 82080\n",
|
|
|
|
|
"893 894 1436 1060 76440\n",
|
|
|
|
|
"894 895 1560 770 96610\n",
|
|
|
|
|
"895 896 1429 1110 54340\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 4 columns]"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 13,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"output_type": "execute_result"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df.drop(\"Store_Area\", axis=1)"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"Удаление строки"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 14,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store ID</th>\n",
|
|
|
|
|
" <th>Store_Area</th>\n",
|
|
|
|
|
" <th>Items_Available</th>\n",
|
|
|
|
|
" <th>Daily_Customer_Count</th>\n",
|
|
|
|
|
" <th>Store_Sales</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>1461</td>\n",
|
|
|
|
|
" <td>1752</td>\n",
|
|
|
|
|
" <td>210</td>\n",
|
|
|
|
|
" <td>39820</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>3</td>\n",
|
|
|
|
|
" <td>1340</td>\n",
|
|
|
|
|
" <td>1609</td>\n",
|
|
|
|
|
" <td>720</td>\n",
|
|
|
|
|
" <td>54010</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>1451</td>\n",
|
|
|
|
|
" <td>1748</td>\n",
|
|
|
|
|
" <td>620</td>\n",
|
|
|
|
|
" <td>53730</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>1770</td>\n",
|
|
|
|
|
" <td>2111</td>\n",
|
|
|
|
|
" <td>450</td>\n",
|
|
|
|
|
" <td>46620</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>5</th>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" <td>1442</td>\n",
|
|
|
|
|
" <td>1733</td>\n",
|
|
|
|
|
" <td>760</td>\n",
|
|
|
|
|
" <td>45260</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>891</th>\n",
|
|
|
|
|
" <td>892</td>\n",
|
|
|
|
|
" <td>1582</td>\n",
|
|
|
|
|
" <td>1910</td>\n",
|
|
|
|
|
" <td>1080</td>\n",
|
|
|
|
|
" <td>66390</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>892</th>\n",
|
|
|
|
|
" <td>893</td>\n",
|
|
|
|
|
" <td>1387</td>\n",
|
|
|
|
|
" <td>1663</td>\n",
|
|
|
|
|
" <td>850</td>\n",
|
|
|
|
|
" <td>82080</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>893</th>\n",
|
|
|
|
|
" <td>894</td>\n",
|
|
|
|
|
" <td>1200</td>\n",
|
|
|
|
|
" <td>1436</td>\n",
|
|
|
|
|
" <td>1060</td>\n",
|
|
|
|
|
" <td>76440</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>894</th>\n",
|
|
|
|
|
" <td>895</td>\n",
|
|
|
|
|
" <td>1299</td>\n",
|
|
|
|
|
" <td>1560</td>\n",
|
|
|
|
|
" <td>770</td>\n",
|
|
|
|
|
" <td>96610</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>895</th>\n",
|
|
|
|
|
" <td>896</td>\n",
|
|
|
|
|
" <td>1174</td>\n",
|
|
|
|
|
" <td>1429</td>\n",
|
|
|
|
|
" <td>1110</td>\n",
|
|
|
|
|
" <td>54340</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>895 rows × 5 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
" Store ID Store_Area Items_Available Daily_Customer_Count Store_Sales\n",
|
|
|
|
|
"1 2 1461 1752 210 39820\n",
|
|
|
|
|
"2 3 1340 1609 720 54010\n",
|
|
|
|
|
"3 4 1451 1748 620 53730\n",
|
|
|
|
|
"4 5 1770 2111 450 46620\n",
|
|
|
|
|
"5 6 1442 1733 760 45260\n",
|
|
|
|
|
".. ... ... ... ... ...\n",
|
|
|
|
|
"891 892 1582 1910 1080 66390\n",
|
|
|
|
|
"892 893 1387 1663 850 82080\n",
|
|
|
|
|
"893 894 1200 1436 1060 76440\n",
|
|
|
|
|
"894 895 1299 1560 770 96610\n",
|
|
|
|
|
"895 896 1174 1429 1110 54340\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[895 rows x 5 columns]"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 14,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
2024-09-20 23:45:27 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"df.drop(0, axis=0)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Создание новых столбцов"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"1. Создание нового столбца с доходом на одного клиента"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 15,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Revenue_per_Customer</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>125.452830</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>189.619048</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>75.013889</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>86.661290</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>103.600000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>891</th>\n",
|
|
|
|
|
" <td>61.472222</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>892</th>\n",
|
|
|
|
|
" <td>96.564706</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>893</th>\n",
|
|
|
|
|
" <td>72.113208</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>894</th>\n",
|
|
|
|
|
" <td>125.467532</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>895</th>\n",
|
|
|
|
|
" <td>48.954955</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 1 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Revenue_per_Customer\n",
|
|
|
|
|
"0 125.452830\n",
|
|
|
|
|
"1 189.619048\n",
|
|
|
|
|
"2 75.013889\n",
|
|
|
|
|
"3 86.661290\n",
|
|
|
|
|
"4 103.600000\n",
|
|
|
|
|
".. ...\n",
|
|
|
|
|
"891 61.472222\n",
|
|
|
|
|
"892 96.564706\n",
|
|
|
|
|
"893 72.113208\n",
|
|
|
|
|
"894 125.467532\n",
|
|
|
|
|
"895 48.954955\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 1 columns]"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 15,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"df[\"Revenue_per_Customer\"] = df[\"Store_Sales\"] / df[\"Daily_Customer_Count\"]\n",
|
|
|
|
|
"df[[\"Revenue_per_Customer\"]]"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Удаление строк с пустыми значениями"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"1. Удаление строк с NaN"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 16,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"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>Store ID</th>\n",
|
|
|
|
|
" <th>Store_Area</th>\n",
|
|
|
|
|
" <th>Items_Available</th>\n",
|
|
|
|
|
" <th>Daily_Customer_Count</th>\n",
|
|
|
|
|
" <th>Store_Sales</th>\n",
|
|
|
|
|
" <th>Revenue_per_Customer</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>0</th>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>1659</td>\n",
|
|
|
|
|
" <td>1961</td>\n",
|
|
|
|
|
" <td>530</td>\n",
|
|
|
|
|
" <td>66490</td>\n",
|
|
|
|
|
" <td>125.452830</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>1</th>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" <td>1461</td>\n",
|
|
|
|
|
" <td>1752</td>\n",
|
|
|
|
|
" <td>210</td>\n",
|
|
|
|
|
" <td>39820</td>\n",
|
|
|
|
|
" <td>189.619048</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>2</th>\n",
|
|
|
|
|
" <td>3</td>\n",
|
|
|
|
|
" <td>1340</td>\n",
|
|
|
|
|
" <td>1609</td>\n",
|
|
|
|
|
" <td>720</td>\n",
|
|
|
|
|
" <td>54010</td>\n",
|
|
|
|
|
" <td>75.013889</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>3</th>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>1451</td>\n",
|
|
|
|
|
" <td>1748</td>\n",
|
|
|
|
|
" <td>620</td>\n",
|
|
|
|
|
" <td>53730</td>\n",
|
|
|
|
|
" <td>86.661290</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>4</th>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>1770</td>\n",
|
|
|
|
|
" <td>2111</td>\n",
|
|
|
|
|
" <td>450</td>\n",
|
|
|
|
|
" <td>46620</td>\n",
|
|
|
|
|
" <td>103.600000</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>891</th>\n",
|
|
|
|
|
" <td>892</td>\n",
|
|
|
|
|
" <td>1582</td>\n",
|
|
|
|
|
" <td>1910</td>\n",
|
|
|
|
|
" <td>1080</td>\n",
|
|
|
|
|
" <td>66390</td>\n",
|
|
|
|
|
" <td>61.472222</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>892</th>\n",
|
|
|
|
|
" <td>893</td>\n",
|
|
|
|
|
" <td>1387</td>\n",
|
|
|
|
|
" <td>1663</td>\n",
|
|
|
|
|
" <td>850</td>\n",
|
|
|
|
|
" <td>82080</td>\n",
|
|
|
|
|
" <td>96.564706</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>893</th>\n",
|
|
|
|
|
" <td>894</td>\n",
|
|
|
|
|
" <td>1200</td>\n",
|
|
|
|
|
" <td>1436</td>\n",
|
|
|
|
|
" <td>1060</td>\n",
|
|
|
|
|
" <td>76440</td>\n",
|
|
|
|
|
" <td>72.113208</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>894</th>\n",
|
|
|
|
|
" <td>895</td>\n",
|
|
|
|
|
" <td>1299</td>\n",
|
|
|
|
|
" <td>1560</td>\n",
|
|
|
|
|
" <td>770</td>\n",
|
|
|
|
|
" <td>96610</td>\n",
|
|
|
|
|
" <td>125.467532</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>895</th>\n",
|
|
|
|
|
" <td>896</td>\n",
|
|
|
|
|
" <td>1174</td>\n",
|
|
|
|
|
" <td>1429</td>\n",
|
|
|
|
|
" <td>1110</td>\n",
|
|
|
|
|
" <td>54340</td>\n",
|
|
|
|
|
" <td>48.954955</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>896 rows × 6 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Store ID Store_Area Items_Available Daily_Customer_Count \\\n",
|
|
|
|
|
"0 1 1659 1961 530 \n",
|
|
|
|
|
"1 2 1461 1752 210 \n",
|
|
|
|
|
"2 3 1340 1609 720 \n",
|
|
|
|
|
"3 4 1451 1748 620 \n",
|
|
|
|
|
"4 5 1770 2111 450 \n",
|
|
|
|
|
".. ... ... ... ... \n",
|
|
|
|
|
"891 892 1582 1910 1080 \n",
|
|
|
|
|
"892 893 1387 1663 850 \n",
|
|
|
|
|
"893 894 1200 1436 1060 \n",
|
|
|
|
|
"894 895 1299 1560 770 \n",
|
|
|
|
|
"895 896 1174 1429 1110 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Store_Sales Revenue_per_Customer \n",
|
|
|
|
|
"0 66490 125.452830 \n",
|
|
|
|
|
"1 39820 189.619048 \n",
|
|
|
|
|
"2 54010 75.013889 \n",
|
|
|
|
|
"3 53730 86.661290 \n",
|
|
|
|
|
"4 46620 103.600000 \n",
|
|
|
|
|
".. ... ... \n",
|
|
|
|
|
"891 66390 61.472222 \n",
|
|
|
|
|
"892 82080 96.564706 \n",
|
|
|
|
|
"893 76440 72.113208 \n",
|
|
|
|
|
"894 96610 125.467532 \n",
|
|
|
|
|
"895 54340 48.954955 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[896 rows x 6 columns]"
|
|
|
|
|
]
|
|
|
|
|
},
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 16,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"df.dropna()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"2. Заполнить пустые значения для определённого столбца"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 17,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"df.fillna({\"Store_Sales\": df[\"Store_Sales\"].mean()}, inplace=True)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Заполнение пустых значений"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"1. Заполнение средним значением"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 18,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"df.fillna(df.mean(), inplace=True)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Визуализация данных с Pandas и Matplotlib"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"1. Линейная диаграмма (plot). Продажи по магазинам"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 19,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
2024-09-07 00:57:54 +04:00
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAl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ceTIEcXx9PR0xd979uwBAPzrX/9CpUqVFP9+//13Kmfz+vXr46uvvsLZs2exefNmvP7664iMjMSwYcPwxx9/SOm2bduG2267DUlJSUhMTESlSpUkQSQrK0sz/z179iArKwspKSkBdbx06ZJUx65du+KOO+7A//73P1SsWBG33norpkyZgvz8fMN7AIC6detCEISAewMgrcJLTk7GzTffjBkzZkhppk+fjqpVqxqaPwGfwPvRRx/hxIkT2LVrFyZNmiSZYz///HPD6w8dOoR69erB41EOCY0aNZLOy1G/771790IURbz00ksBz9IfAsOJBQb+cBFly5ZlnjeHYwXuU8XhlGKio6PRrl07tGvXDvXr18fgwYMxa9Ys5rGe5NoiwOcADvj8qtLS0gLSR0bSdz0RERFo1qwZmjVrho4dO+KGG27A9OnTkZGRgczMTHTt2hWJiYkYPXq0FNNq/fr1eO6556R6kPB6vUhJSVFoh+T4NTGCIOD777/HP//8g59//hkLFizAgw8+iPHjx+Off/6RtCV2uf/++zFr1iysWLECzZo1w9y5c/HYY48FCDp6CIKA+vXro379+ujduzfq1auH6dOn46GHHmJSRz9a7/s///kPevbsSbymbt26TOsAAFu3bkVKSgoSExOZ583hWIELVRzOVULbtm0BACdOnJCOqTUogE+YiI+Px65duwLO7dy5Ex6PB9WrV9cty+/wnpKSgoyMDDvVVqC+hz///BP
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
2024-09-20 23:45:27 +04:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
|
|
"df.plot(x=\"Store ID \", y=\"Store_Sales\", kind=\"line\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.xlabel(\"Store ID\") \n",
|
|
|
|
|
"plt.ylabel(\"Store Sales\")\n",
|
|
|
|
|
"plt.title(\"Store Sales by Store ID\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"2. Столбчатая диаграмма (bar). Средние продажи"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 20,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
2024-09-07 00:57:54 +04:00
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlwAAAHTCAYAAADyEsYgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABk+ElEQVR4nO3dd1xT9/4/8FdCSAKEMGSJyhAHijhwUFzViqLFOuqoVisqVW/deq+ttpU6Wq22zmodtYparavVOiruVcWFG0et4jaAMsKQmfP7w1/O1xREUAIBXs/HIw/NOZ9zzvucDF4543MkgiAIICIiIiKjkZZ2AURERETlHQMXERERkZExcBEREREZGQMXERERkZExcBEREREZGQMXERERkZExcBEREREZGQMXERERkZExcBEREREZGQMXEVUIAwcOhIeHR4ku08PDA507dy7RZRKRaWLgIiqHLl++jJ49e8Ld3R1KpRJVqlRB+/bt8cMPPxi0mzFjBrZt21Y6Rb7CnTt3MGjQIHh5eUGpVMLFxQWtW7fGV199VdqlmZz4+HiMGTMG3t7esLCwgJOTE5o1a4bPPvsMqampYrv169dj/vz5pVdoASQSCUaOHCk+v3PnDiQSifgwNzeHg4MDmjdvjs8//xz37t0rxWqJik7CeykSlS8nTpxA27Zt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PoynT5/i999/R+vWrcV2MTExr5yXl5cX9u/fjxYtWuQJEPl566238NZbb+Gbb77B+vXr0a9fP2zYsOGVYUa/9+fFbf33338DgMGFAx07doSjoyPWrVsHf39/pKen46O
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df.plot(x=\"Store ID \", y=\"Store_Sales\", kind=\"bar\")\n",
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"\n",
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"plt.xlabel(\"Store ID\") \n",
|
|
|
|
|
"plt.ylabel(\"Store Sales\")\n",
|
|
|
|
|
"plt.title(\"Store Sales by Store ID\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.show()"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"3. Гистограмма (hist). Распределение количества товаров"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 21,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkwAAAHHCAYAAABN+wdFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly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X79+/XJ598Yl+e3Rym5cuXq379+vL395ePj48qVaqkl156SdKleUd33XWXJKlHjx7203+Zh+MbN26satWqafPmzWrYsKG8vLzsr81pzsbFixf10ksvKTQ0VN7e3mrTpo3++usvhzYRERHZ/u/18j6tastujseZM2c0ePBglSlTRh4eHqpUqZLeeustGWMc2tlsNvXr108LFy5UtWrV5OHhoapVq2rp0qXZD/gVjhw5op49eyokJERFixZVjRo1NHPmTPv6zPlc+/bt07fffmuvPSEh4Zr6T0hIUFBQkCTp1Vdftb/+8nk4u3bt0kMPPaSAgAAVLVpUd955p7766iuHfjJP665bt079+/dXUFCQ/P399dRTT+nChQs6efKkunbtquLFi6t48eJ6/vnns4zVnDlzVLt2bRUrVky+vr6KiorSxIkTr2k7Dhw4oB9++EGdOnVSp06dtG/fPm3YsMG+vl+/fvLx8dHZs2ezvLZz584KDQ3VxYsXJUmLFi1Sq1atFBYWJg8PD1WoUEGvvfaafX2ma5n7s3//fvXp00eVKlWSp6enSpQooYcffjjHn8/Zs2f11FNPqUSJEvL19VXXrl114sQJy+1PTU3V8OHDVbFiRXl4eKhMmTJ6/vnnlZqaavnaK7cjISFBNptNb731lj744ANVqFBBHh4euuuuu/Tzzz9b9rd3716VLl06S1iSpODgYPu/IyIitGPHDq1Zs8a+313+e/7nn3/q4YcfVkBAgLy8vFSvXj19++23Dv1l7v9z5szRf/7zH5UqVUpeXl5KTk6WJG3cuFHNmzeXn5+fvLy81KhRI61fv96hj9OnT2vgwIGKiIiQh4eHgoODdd999+mXX36x3FbkXxxhglM89thjeumll/Tdd9/pySefzLbNjh07dP/996t69eoaOXKkPDw8tGfPHvuHU+XKlTVy5EgNGzZMvXr1UoMGDSRJd999t72PY8eOqUWLFurUqZMeffRRhYSEXLWu//73v7LZbHrhhRd05MgRTZgwQTExMdqyZYv9SNi1uJbaLmeMUZs2bbRq1Sr17NlTNWvW1LJlyzRkyBD9/fffGj9+vEP7devW6YsvvlCfPn1UrFgxvfPOO2rfvr0OHDigEiVK5F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p6ebkqXLu0w/gMGDDC+vr4mPT39mrbhSlFRUaZLly725y+99JIJDAw0aWlp9ppLlSpl2rdv7/C6zH1m7dq19mVnz57N0v9TTz1lvLy8HMbhyv3CGJNlHLPrKy4uzkgys2bNsi/LHL/atWubCxcu2Je/+eabRpJZtGiRfdmV++7HH39sXFxczA8//ODwPlOnTjWSzPr167PUcLkrt2Pfvn1GkilRooQ5fvy4ffmiRYuMJPP1119ftb/t27cbT09PI8nUrFnTDBgwwCxcuNCcOXMmS9uqVas6bEumgQMHGkkO23T69GlTrlw5ExERYS5evGiM+b/PgvLlyzuMdUZGhomMjMyyP549e9aUK1fO3HffffZlfn5+pm/fvlfdJhQ8nJKD0/j4+Fz1ajl/f39Jl05n5HYCqYeHh3r06HHN7bt27apixYrZnz/00EMqWbKkFi9enKv3v1aLFy+Wq6ur+vfv77B88ODBMsZoyZIlDstjYmJUoUIF+/Pq1avL19dXf/75p+X7hIaGqnPnzvZlRYoUUf/+/ZWSkqI1a9bkwdbk7Pjx41q5cqU6dOig06dP659//tE///yjY8eOKTY2Vrt379bff//t8JqePXs
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"df[\"Items_Available\"].plot(kind=\"hist\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.xlabel(\"Number of Items Available\") \n",
|
|
|
|
|
"plt.ylabel(\"Frequency\") \n",
|
|
|
|
|
"plt.title(\"Distribution of Items Available in Stores\") \n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"4. Ящик с усами (box). Продажи"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 22,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
2024-09-07 00:57:54 +04:00
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlUAAAGzCAYAAAAG8+KwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABIsUlEQVR4nO3de5yN5R7///cc1wxjZpxmxshhkPNEOY5D8jUZGmqSFNoxJtrlrJ3Y5VBkihQqSftb6ETayCEkhJjk0GgckoqIZkhmjbM5XL8/9m/ur9UMZnQzs3g9H4/7kfu+Putan3vV3uvtXve6locxxggAAAB/i2dRNwAAAHAjIFQBAADYgFAFAABgA0IVAACADQhVAAAANiBUAQAA2IBQBQAAYANCFQAAgA0IVQAAADYgVAEoVg4cOCAPDw/NmjWrqFtxsWLFCjVs2FB+fn7y8PBQenp6UbfkVnr37q2qVasWdRvANUWoAm5Qs2bNkoeHh8sWEhKitm3bavny5de9n6+++sqlFx8fH1WrVk2PPvqofvnlF1ueY9OmTRo7dqztgef48ePq1q2b/P399eabb+r9999XyZIlL1mfkpKirl27qkqVKvLz81PFihV199136/XXX3epmzBhghYtWmRrr3Y5cOCA4uPjVb16dfn5+SksLEx33nmnxowZU9StAcWWd1E3AODaeuGFFxQRESFjjNLS0jRr1izdc889WrJkiTp16nTd+xk0aJCaNGmizMxMbd++XTNnztSyZcuUkpKi8PDwvzX3pk2b9Pzzz6t3794KDg62p2FJW7Zs0cmTJzVu3DhFR0dfsYe2bduqcuXK6tu3r8LCwnTo0CF98803mjp1qgYOHGjVTpgwQV27dlVcXJxtvdrhp59+UpMmTeTv768+ffqoatWq+v3337V9+3a9/PLLev7554u6RaBYIlQBN7iOHTuqcePG1n5CQoJCQ0P18ccfF0moat26tbp27SpJio+PV82aNTVo0CDNnj1bI0eOvO79FMTRo0clqUBB7cUXX1RQUJC2bNmSpz53nmvp9OnTl72KVhCvvfaaTp06peTkZFWpUsVl7HqcA+Cu+PgPuMkEBwfL399f3t6uf6c6ffq0nnrqKVWqVEkOh0O1atXSK6+8ImOMJOns2bOqXbu2ateurbNnz1qP+/PPP1WhQgW1aNFC2dnZhe7n//yf/yNJ2r9//2Xr1qxZo9atW6tkyZIKDg7Wfffdpz179ljjY8eO1dNPPy1JioiIsD5mPHDgwGXnnT9/vho1aiR/f3+VK1dOjzzyiA4fPmyN33XXXerVq5ckqUmTJvLw8FDv3r0vOd/PP/+sevXq5RvAQkJCrD97eHjo9OnTmj17ttXrxfN+99136tixowIDAxUQEKB27drpm2++cZkv9yPedevW6cknn1RISIhuueUWa3z58uXWa1aqVCnFxsZq165dl309cs/hlltuyROo/noOkvTZZ58pNjZW4eHhcjgcql69usaNG1eg/xZycnI0ZcoU1atXT35+fgoNDdXjjz+uEydOuNRt3bpVMTExKleunPz9/RUREaE+ffpccX7geuNKFXCDczqd+uOPP2SM0dGjR/X666/r1KlTeuSRR6waY4zuvfderV27VgkJCWrYsKFWrlypp59+WocPH9Zrr70mf39/zZ49Wy1bttSzzz6rV199VZLUv39/OZ1OzZo1S15eXoXu7+eff5YklS1b9pI1X375pTp27Khq1app7NixOnv2rF5//XW1bNlS27dvV9WqVdWlSxf9+OOP+vjjj/Xaa6+pXLlykqTy5ctfct5Zs2YpPj5eTZo0UWJiotLS0jR16lRt3LhR3333nYKDg/Xss8+qVq1amjlzpvVRavXq1S85Z5UqVZSUlKSdO3eqfv36l6x7//339dhjj6lp06bq16+fJFnz7tq1S61bt1ZgYKCGDx8uHx8fvf3227rrrru0bt06NWvWzGWuJ598UuXLl9fo0aN1+vRpa/5evXopJiZGL7/8ss6cOaO33npLrVq10nfffXfZm8arVKmiL7/8UmvWrLFC7+Vew4CAAA0bNkwBAQFas2aNRo8erYyMDE2aNOmyj3388cetfweDBg3S/v379cYbb+i7777Txo0b5ePjo6NHj6p9+/YqX768RowYoeDgYB04cEALFiy47NxAkTAAbkjvvfeekZRnczgcZtasWS61ixYtMpLM+PHjXY537drVeHh4mJ9++sk6NnLkSOPp6WnWr19v5s+fbySZKVOmXLGftWvXGknm3XffNceOHTNHjhwxy5YtM1WrVjUeHh5my5Ytxhhj9u/fbySZ9957z3psw4YNTUhIiDl+/Lh1bMeOHcbT09M8+uij1rFJkyYZSWb//v1X7OfChQsmJCTE1K9f35w9e9Y6vnTpUiPJjB492jqW+1rm9ng5X3zxhfHy8jJeXl4mKirKDB8+3KxcudJcuHAhT23JkiVNr1698hyPi4szvr6+5ueff7aOHTlyxJQqVcrceeedefpq1aqVycrKso6fPHnSBAcHm759+7rMm5qaaoKCgvIc/6udO3caf39/I8k0bNjQDB482CxatMicPn06T+2ZM2fyHHv88cdNiRIlzLlz56xjvXr1MlWqVLH2N2zYYCSZDz/80OWxK1ascDm+cOHCAr/2QFEjVAE3qNw33DfffNOsWrXKrFq1ynzwwQemQ4cOxtvb2/z3v/+1avv162e8vLxMRkaGyxxJSUlGknn99detY+fPnzeRkZEmIiLClC9f3rRp08bk5ORcsZ/cUPXXrXz58mbOnDlW3V9D1ZEjR4wkM3z48DxzxsTEmHLlyln7hQlVmzZtMpLM9OnT84zVrl3bNGrUyNovTKgyxphvv/3W3H///aZEiRIu5/nZZ5+51OUXqrKyskyJEiVMt27d8sz7+OOPG09PT+N0Ol36mj17tkvdggULjCSzZs0ac+zYMZetffv2pkaNGlc8h71795pHHnnEBAcHW+cQEBBgZs6cecnHZGRkmGPHjpkPPvjASDLJycnW2F9D1aBBg0xQUJA5evRonh4DAgLMY489Zoz5f//djBkzJt9gChQnfPwH3OCaNm3qcqN69+7ddfvtt2vAgAHq1KmTfH199euvvyo8PFylSpVyeWydOnUkSb/++qt1zNfXV++++66aNGkiPz8/vffee/Lw8ChwP6NHj1br1q3l5eWlcuXKqU6dOnnu77pY7nPXqlUrz1idOnW0cuXKq7o5+3Lz1q5dW19//XWh5rtYkyZNtGDBAl24cEE7duzQwoUL9dprr6lr165KTk5W3bp1L/nYY8eO6cyZM5c835ycHB06dEj16tWzjkdERLjU7du3T5Iu+dFdYGDgFc+hZs2aev/995Wdna3du3dr6dKlmjhxovr166eIiAjrW5C7du3Sc889pzVr1igjI8NlDqfTecn59+3bJ6fTmecerVy5N8S3adNGDzzwgJ5//nm99tpruuuuuxQXF6cePXrI4XBc8TyA64lQBdxkPD091bZtW02dOlX79u1zeXMuqJUrV0qSzp07p3379uV5U7+cyMjIKy5LcKPw9fVVkyZN1KRJE9WsWVPx8fGaP3++7Ws9+fv7u+zn5ORI+t99VWFhYXnqLxdi/8rLy0uRkZGKjIxUVFSU2rZtqw8//FDR0dFKT09XmzZtFBgYqBdeeMFa02r79u165plnrD7yk5OTo5CQEH344Yf5jufeC+fh4aFPP/1U33zzjZYsWaKVK1eqT58+mjx5sr755hsFBAQU+FyAa41QBdyEsrKyJEmnTp2S9P9uTD558qTL1aoffvjBGs/1/fff64UXXlB8fLySk5P12GOPKSUlRUFBQdek19zn3rt3b56xH374QeXKlbOuUhXmitnF8/71is7evXvz/ebb35F7tfD333+3juXXb/ny5VWiRIlLnq+np6cqVap02efKveE9JCTE1gD713P46quvdPz4cS1YsEB33nmnVXelb3Lm9vjll1+qZcuWeUJhfpo3b67mzZvrxRdf1EcffaSePXtq7ty5euyxx67ybAD7saQCcJPJzMzUF198IV9fX+v
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df[\"Store_Sales\"].plot(kind=\"box\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.ylabel(\"Store Sales (US $)\") \n",
|
|
|
|
|
"plt.title(\"Box Plot of Store Sales\") \n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.show()"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"5. Диаграмма с областями (area). "
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 23,
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"data": {
|
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlUAAAHHCAYAAACWQK1nAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACaSElEQVR4nO2dd3wU1frGn00PhCQgJAGlBCxUUUARsf6IRMSCAl6Qq4AIFlAQLypeQaWIoiKgXhALTRBEASmKQqhCaIFQQpEOAgk1CUlI3fn9EXYyszszO7M7W5I8388Hzc6cOfNOO/PMe97zHosgCAIIIYQQQohbBPjaAEIIIYSQigBFFSGEEEKICVBUEUIIIYSYAEUVIYQQQogJUFQRQgghhJgARRUhhBBCiAlQVBFCCCGEmABFFSGEEEKICVBUEUIIIYSYAEUVIaRS0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mrz9Yl9+mnn2LixIlo1KgRQkNDsW/fPgDAgQMH0K1bN9SoUQNhYWFo06YNlixZovs86aV+/fqYMWMGCgsLMX78eNPrJ8RV6KkipIJRv359JCcnY+/evWjevLlqudmzZ+OFF17AnXfeiQEDBgAAGjVqBABIS0vDvffei8jISLz55psIDg7G119/jQceeADr1q1D27ZtZXW98sorqFWrFkaOHInc3Fyx/t69eyMxMREff/wx8vLyMGXKFNxzzz3YuXOnZtB4/fr1sWrVKqxevRr/93//p3m8M2bMQEREBIYOHYqIiAisXr0aI0eORHZ2Nj755BPNbV988UXMmDEDffv2xWuvvYZjx47hyy+/xM6dO7Fx40YEBwfj3Llz6NixI2rVqoW3334b0dHROH78uEwYaXHo0CH861//wksvvYTevXtj+vTp6N69O1asWIGHHnoIDRs2RPv27TFnzhy8/vrrsm3nzJmDatWq4YknntA8VyUlJeL5VuO///0vsrKy8M8//4gCLiIiAgBw9epVPPDAAzh8+DAGDRqE+Ph4LFiwAH369EFmZiYGDx4sq2v69OnIz8/HgAEDEBoaiho1aiAtLQ3t27fH9ddfj7fffhtVq1bFTz/9hC5duuCXX37Bk08+qet86aVdu3Zo1KgRVq5caWq9hLiFQAipUPz5559CYGCgEBgYKLRr10548803hT/++EMoLCx0KFu1alWhd+/eDsu7dOkihISECEeOHBGXnTlzRqhWrZpw3333icumT58uABDuueceobi4WFx+5coVITo6Wujfv7+s3vT0dCEqKsphuT179+4VwsPDBQDCbbfdJgwePFhYvHixkJub61A2Ly/PYdmLL74oVKlSRcjPzxeX9e7dW6hfv774e8OGDQIAYc6cObJtV6xYIVu+aNEiAYCwbds2TZuVqF+/vgBA+OWXX8RlWVlZQu3atYXbb79dXPb1118LAIT9+/eLywoLC4WaNWsqXh8p6enpQq1atQQAQuPGjYWXXnpJmDt3rpCZmelQtnPnzrJzYGPixIkCAOGHH36Q7b9du3ZCRESEkJ2dLQiCIBw7dkwAIERGRgrnzp2T1dGhQwehRYsWsnNutVqFu+++W7jppps0j0EQBAGAMHD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/88PvvsM2zevFn0lrjLc889hwULFmDTpk1o0aIFlixZgldeecVB6GhhsVhw88034+abb0bnzp1x0003Yc6cOXjhhRdMsdGG2vX+z3/+g8TERMVtbrzxRlNtAIC9e/ciJiYGkZGRptdNiCtQVBFSSWjTpg0A4OzZs+Iyew8KUComqlSpgoMHDzqsO3DgAAICAlC3bl3NfdkC3mNiYpCQkOCO2TLsj2Ht2rW4ePEiFi5ciPvuu08sd+zYMad1NWrUCKt
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"df.plot(x=\"Store ID \", y=\"Store_Sales\", kind=\"area\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.xlabel(\"Store ID\") \n",
|
|
|
|
|
"plt.ylabel(\"Store Sales\")\n",
|
|
|
|
|
"plt.title(\"Store Sales by Store ID\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"6. Диаграмма рассеяния (scatter). Зависимость продаж от количества посетителей"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 24,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
2024-09-07 00:57:54 +04:00
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlwAAAHHCAYAAABqVYatAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGli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dtttSE1NxV133YVff/0VCxcuxODBg9G4cWNs3LhR9feVlZXYvHkzhg8fjmbNmlmXN2rUCKNHj8auXbtQXFxs85vHHnsMvr6+1r+3bNmCwsJCjBo1CpcuXbL+8/X1RVJSElJSUhT70L59exw+fBgPPfQQsrOz8e6772L48OFo0KCBXa5JYGCg9f+vXLmCS5cuoU+fPigrK8Pvv/8uu4/169cjNDQUt912m00fExISEBwcbO0jnwf3/fffo7y8XPnkCQgJCcEdd9yBL7/80sb7sG7dOnTv3h1Nmza12f63337rlBmEvMfgypUr1mV6z6EUY8eOxbVr1/DVV19Zl61btw4VFRV2eWViiouLUbduXU37YyEsLAzHjh3DiRMnNP/2xx9/hK+vL6ZNm2az/JlnngHHcfjpp59slt9666023lveGzxixAibY+OXZ2VlAQAOHz6MEydOYPTo0cjPz7fej6Wlpbj11luxY8cOu/vj8ccfZzoGLef1f//7H65fv47p06fDx+fGsPnYY48hJCQEP/zwA9N2pEhOToa/v7/17z59+gC4cQ4I74EMLqLGkJiYiK+//hoFBQVIS0vDrFmzcOXKFdx33304fvy44m/z8vJQVlaG1q1b261r27YtqqqqcPbsWZvl8fHxNn/zA9uAAQMQFRVl82/
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"df.plot(kind=\"scatter\", x=\"Daily_Customer_Count\", y=\"Store_Sales\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.xlabel(\"Daily Customer Count\") \n",
|
|
|
|
|
"plt.ylabel(\"Store Sales (US $)\")\n",
|
|
|
|
|
"plt.title(\"Store Sales vs. Daily Customer Count\") \n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"7. Круговая диаграмма (pie). Количество товаров"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-09-28 10:43:58 +04:00
|
|
|
|
"execution_count": 25,
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgcAAAEqCAYAAACBe/NOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABXyElEQVR4nO3ddVgU69sH8O8usIB0iqDSSlgIylFUFDBRbAzsPLboOebPjnM8HhUTu7FbDCws7A5awUBK6Y593j887OsKKCAwC3t/rotLmZ2d+e7s7HDvM888w2OMMRBCCCGE/IfPdQBCCCGESBYqDgghhBAihooDQgghhIih4oAQQgghYqg4IIQQQogYKg4IIYQQIoaKA0IIIYSIoeKAEEIIIWKoOCCEEEKImAovDhYuXAgej1fRqwEAtG3bFm3bthX9fv36dfB4PBw7dqxS1j9s2DAYGRlVyrrKKi0tDaNGjYKenh54PB6mTp3KSQ4jIyMMGzZM9HvBe3X9+nVO8hDpFhkZCR6Ph927d3MdpUpKS0uDrq4ufHx8uI4itYrah2fNmgV7e/syLa9UxcHu3bvB4/FEPwoKCtDX10fHjh2xbt06pKamlinE9z59+oSFCxfi2bNn5bK88iTJ2Upi+fLl2L17N8aNG4d9+/Zh8ODBxc5rZGQkeq/5fD7U1dXRsGFDjBkzBvfv36/E1GX37NkzDBo0CHXq1IG8vDw0NTXh4uKCXbt2IT8/v0LWuWnTpmr/R4aL7Vpay5cvx6lTpzhb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ODqak
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"# Определение порога для объединения редких значений\n",
|
|
|
|
|
"threshold = 0.02 # Порог 2%\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Подсчёт количества уникальных значений и расчёт частот\n",
|
|
|
|
|
"value_counts = df[\"Daily_Customer_Count\"].value_counts()\n",
|
|
|
|
|
"total_count = value_counts.sum()\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# Условие для агрегации значений ниже порога\n",
|
|
|
|
|
"other_values = value_counts[value_counts / total_count < threshold].sum()\n",
|
|
|
|
|
"main_values = value_counts[value_counts / total_count >= threshold]\n",
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"\n",
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"# Добавление категории \"Other\"\n",
|
|
|
|
|
"main_values[\"Other\"] = other_values\n",
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"\n",
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"# Построение диаграммы\n",
|
|
|
|
|
"main_values.plot(kind=\"pie\", \n",
|
|
|
|
|
" autopct='%1.1f%%', # Проценты\n",
|
|
|
|
|
" startangle=90, # Начальный угол\n",
|
|
|
|
|
" counterclock=False, # По часовой стрелке\n",
|
|
|
|
|
" cmap=\"Set3\", # Цветовая схема\n",
|
|
|
|
|
" wedgeprops={'edgecolor': 'black'}) # Границы сегментов\n",
|
2024-09-07 00:57:54 +04:00
|
|
|
|
"\n",
|
2024-09-20 23:45:27 +04:00
|
|
|
|
"plt.title(\"Distribution of Daily Customer Count in Stores (Aggregated)\")\n",
|
|
|
|
|
"plt.subplots_adjust(left=0.3, right=0.7, top=0.9, bottom=0.1)\n",
|
|
|
|
|
"plt.show()\n"
|
2024-09-07 00:57:54 +04:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"kernelspec": {
|
|
|
|
|
"display_name": ".venv",
|
|
|
|
|
"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
|
|
|
|
|
}
|