AIM-PIbd-32-Fedorenko-G-Y/lab_1/lab1.ipynb

174 lines
147 KiB
Plaintext
Raw Normal View History

2024-09-14 14:30:07 +04:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Выгрузка данных из csv файла в датафрейм"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Index(['category', 'sub_category', 'href', 'items', 'price'], dtype='object')\n"
]
}
],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"df = pd.read_csv(\".//static//csv//jio_mart_items.csv\").head(20000)\n",
"print(df.columns)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### **1. Гистограмма распределения цен товаров**"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1sAAAIjCAYAAAD1OgEdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABTw0lEQVR4nO3deVhV5f7+8Xszg4SoBIiKctKcc8BUGhxRMpotTx01c8gyrNSOejyZU4Nlg1qZ5im1U2lpZZOmkvOAWh41p8yKwlQgMkQFAdnP749+7K9bcEKWC+T9uq59Xe31PHutz/qwUe/W2s92GGOMAAAAAAClysPuAgAAAADgckTYAgAAAAALELYAAAAAwAKELQAAAACwAGELAAAAACxA2AIAAAAACxC2AAAAAMAChC0AAAAAsABhCwAAAAAsQNgCAAAAAAsQtgCgFMyZM0cOh8P18PPz09VXX63BgwcrLS3N7vIAAIANvOwuAAAuJxMmTFBUVJROnDihdevWafr06Vq8eLF27typgIAAu8sDAACXEGELAEpRt27d1KpVK0nSgAEDVK1aNb3yyiv67LPPdN9999lcHQAAuJS4jRAALNSpUydJUnJysiTp8OHD+uc//6mmTZsqMDBQQUFB6tatm7Zv317ktSdOnNC4ceN09dVXy8/PT9WrV9ddd92ln376SZL0yy+/uN26ePqjQ4cOrn2tWrVKDodDH374of79738rPDxclSpV0m233ab9+/cXOfamTZt00003qXLlygoICFD79u21fv36Ys+xQ4cOxR5/3LhxRea+9957io6Olr+/v6pWrap777232OOf7dxO5XQ6NWXKFDVu3Fh+fn4KCwvTQw89pD///NNtXp06dXTLLbcUOc7gwYOL7LO42l988cUiPZWk3NxcjR07VnXr1pWvr69q1aqlESNGKDc3t9henapDhw5q0qRJke0vvfSSHA6HfvnlF7ftmZmZGjJkiGrVqiVfX1/VrVtXL7zwgpxOp2tOYd9eeumlIvtt0qRJkfpPd7b30+nnn56erv79+yssLEx+fn5q1qyZ3nnnHbf9nf5z9Pb2Vp06dTR8+HDl5eW55p3v78WFvo8XLFjger+FhISoV69eOnDggNucBx54wK3GKlWqqEOHDlq7du1ZewUA54MrWwBgocJgVK1aNUnSzz//rE8//VT33HOPoqKilJaWpjfffFPt27fX7t27FRERIUkqKCjQLbfcouXLl+vee+/V448/rqNHjyoxMVE7d+7UVVdd5TrGfffdp5tvvtntuKNGjSq2nmeffVYOh0MjR45Uenq6pkyZotjYWG3btk3+/v6SpBUrVqhbt26Kjo7W2LFj5eHhodmzZ6tTp05au3atWrduXWS/NWvW1MSJEyVJx44d06BBg4o99lNPPaUePXpowIAB+v333/Xaa6+pXbt22rp1q4KDg4u8ZuDAgbrxxhslSZ988okWLlzoNv7QQw9pzpw56tu3rx577DElJyfr9ddf19atW7V+/Xp5e3sX24cLkZmZ6Tq3UzmdTt12221at26dBg4cqIYNG2rHjh2aPHmyfvjhB3366acXfexC2dnZat++vQ4cOKCHHnpIkZGR2rBhg0aNGqVDhw5pypQppXKcd9991/Xfa9eu1cyZMzV58mSFhIRIksLCwiRJOTk56tChg3788UcNHjxYUVFRWrBggR544AFlZmbq8ccfd9tv4c8xNzdXS5cu1UsvvSQ/Pz89/fTTks7/96LQ+byPC98X1157rSZOnKi0tDRNnTpV69evL/J+CwkJ0eTJkyVJv/32m6ZOnaqbb75Z+/fvL/Z9CQDnzQAALtrs2bONJPP111+b33//3ezfv9988MEHplq1asbf39/89ttvxhhjTpw4YQoKCtxem5ycbHx9fc2ECRNc22bNmmUkmVdeeaXIsZxOp+t1ksyLL75YZE7jxo1N+/btXc9XrlxpJJkaNWqYrKws1/b58+cbSWbq1KmufderV8/ExcW5jmOMMdnZ2SYqKsp06dKlyLGuu+4606RJE9fz33//3UgyY8eOdW375ZdfjKenp3n22WfdXrtjxw7j5eVVZPu+ffuMJPPOO++4to0dO9ac+tfW2rVrjSTz/vvvu712yZIlRbbXrl3bxMfHF6k9ISHBnP5X4em1jxgxwoSGhpro6Gi3nr777rvGw8PDrF271u31M2bMMJLM+vXrixzvVO3btzeNGzcusv3FF180kkxycrJr29NPP20qVapkfvjhB7e5//rXv4ynp6dJSUkxxlzYe+JcCt/Tp9ZRaMqUKUaSee+991zb8vLyTExMjAkMDHS9xwrrmT17ttvrIyIizM033+x6fr6/F+f7Ps7LyzOhoaGmSZMmJicnxzXvyy+/NJLMmDFjXNv69Oljateu7XbsmTNnGklm8+bN5+gSAJwdtxECQCmKjY3VlVdeqVq1aunee+9VYGCgFi5cqBo1akiSfH195eHx1x+9BQUF+uOPPxQYGKj69evrf//7n2s/H3/8sUJCQvToo48WOcbpt71diPvvv19XXHGF6/ndd9+t6tWra/HixZKkbdu2ad++ffrHP/6hP/74QxkZGcrIyNDx48fVuXNnrVmzxu22Nemv2x39/PzOetxPPvlETqdTPXr0cO0zIyND4eHhqlevnlauXOk2v/AWM19f3zPuc8GCBapcubK6dOnits/o6GgFBgYW2Wd+fr7bvIyMDJ04ceKsdR84cECvvfaannrqKQUGBhY5fsOGDdWgQQO3fRbeOnr68S/GggULdOONN6pKlSpux4qNjVVBQYHWrFnjNj87O7vIuRYUFJRaPYsXL1Z4eLjb5xC9vb312GOP6dixY1q9erXb/GPHjikjI0MHDhzQzJkzlZqaqs6dO7vGz/f3otC53sfffvut0tPT9cgjj7i9N+Pj49WgQQMtWrTIbX9Op9PVp23btum///2vqlevroYNG15ElwCA2wgBoFRNmzZNV199tby8vBQWFqb69eu7/hEp/fWPuqlTp+qNN95QcnKy2z+AC281lP66/bB+/fry8irdP6br1avn9tzhcKhu3bquzwft27dPktSnT58z7uPIkSOqUqWK63lGRkaR/Z5u3759Msaccd7pt/tlZmZKUpGAc/o+jxw5otDQ0GLH09PT3Z4vW7ZMV1555VnrPN3YsWMVERGhhx56SB999FGR4+/Zs+eM+zz9+Bdj3759+u677877WGPHjtXYsWOLzCu8DfBi/frrr6pXr57be1uSK5z8+uuvbtsfffRRt/9x0LdvXw0dOtT1/Hx/Lwqd631cePz69esXeW2DBg20bt06t2379+9362316tX18ccfn/X9BwDng7AFAKWodevWrtUIi/Pcc8/pqaeeUr9+/fT000+ratWq8vDw0JAhQ4pcMbJDYQ0vvviimjdvXuycU/8BmpeXp0OHDqlLly7n3K/D4dBXX30lT0/Ps+5TklJTUyVJ4eHhZ91naGio3n///WLHTw8mbdq00TPPPOO27fXXX9dnn31W7Ov37NmjOXPm6L333iv2s19Op1NNmzbVK6+8Uuzra9WqdcbaL5TT6VSXLl00YsSIYsevvvpqt+cDBw7UPffc47btwQcfLLV6LtTw4cPVtWtXFRQUaNeuXZowYYKMMZo9e7Yk+38vwsLC9N5770n6638mzJo1SzfddJPWrVunpk2bWn58AJcvwhYAXEIfffSROnbsqLfffttte2ZmpmsRAkm66qqrtGnTJuXn55fKIg+FCq9cFTLG6Mcff9Q111zjOq4kBQUFKTY29pz72759u/Lz888aMAv3a4xRVFRUkWBQnN27d8vhcBR7ZeLUfX799de6/vrrXYsinE1ISEiRczrbIhajRo1S8+bN9fe///2Mx9++fbs6d+58Ubd2no+rrrpKx44dO6+fifTXlZ/T51aqVKnU6qldu7a+++47OZ1Ot6tb33//vWv8VI0aNXLVExcXp9zcXP373//Ws88+q4iIiPP+vSh0rvdx4fH37t3ruq2z0N69e4vU5+fn59av2267TVWrVtXrr7+uN99889wNAYAz4DNbAHAJeXp
"text/plain": [
"<Figure size 1000x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(10,6))\n",
"df['price'].plot.hist(bins=100, edgecolor='black', color='skyblue')\n",
"plt.title('Распределение цен товаров')\n",
"plt.xlabel('Цена')\n",
"plt.ylabel('Частота')\n",
"plt.grid(True)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Большая часть товаров дешевле 2000"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### **2. Столбчатая диаграмма количества товаров в каждой категории**"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAscAAAH4CAYAAACmMkDLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAC6xklEQVR4nOzdd3gU1dfA8e+m956QUENJKNJBpagUQYpIEUEpAgrCKyLgDxsoTUAEARWVjoCIgoD0IkU6KL0HCJACIb1v6pZ5/wBW1iSQvinn8zx5dGfu3Dkz7CZn79yiUhRFQQghhBBCCIGZqQMQQgghhBCipJDkWAghhBBCiAckORZCCCGEEOIBSY6FEEIIIYR4QJJjIYQQQgghHpDkWAghhBBCiAckORZCCCGEEOIBSY6FEEIIIYR4QJJjIYQQQgghHpDkWAhRrmzfvp3z588bXm/evJkrV66YLiAhhBAlSrlMjleuXIlKpeL06dNZ9i1duhSVSkXPnj3R6XQmiE4IUZQuXbrEmDFjCAwM5O+//+b//u//SE5ONnVYQgghSohymRznZNOmTbz77rs8//zzrF27FnNzc1OHJIQoZMOGDePevXv4+/vTsmVLWrduTYsWLUwdlhBCiBLCwtQBlBQHDx6kX79+1KtXj23btmFjY2PqkIQQRcDT05PLly9z+fJl7OzsqFu3r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/NzMz4/PPP6d3794AREdHk5qamu39q1u3Lnq9njt37vD
"text/plain": [
"<Figure size 1000x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"category_counts = df['sub_category'].value_counts()\n",
"plt.figure(figsize=(10, 6))\n",
"wedges, texts, autotexts = plt.pie(category_counts, autopct='%1.1f%%', startangle=140, colors=plt.cm.Paired.colors)\n",
"plt.title('Количество товаров в каждой категории')\n",
"plt.legend(wedges, category_counts.index, title=\"Категории\", loc=\"center left\", bbox_to_anchor=(1, 0, 0.5, 1))\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Больше всего товаров в категориях Snacks & Branded Foods и Staples, меньше всего - в категориях Fruits & Vegetables и Premium Fruits"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### **3. Столбчатая диаграмма на срезе данных (1-я по 30-я строка), показывающая цены товаров**"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "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PFlHjhxxGTAqM6ZOnapOnTqpZ8+eSkxM1KJFi/TII49o5cqV6tChw03v9/rrr+vZZ5+VJMXExGjIkCHq16+f7r///jTrPvvss5o/f74efvhhvfjii9q+fbvefvttHTx4UF9//bXLuvfff7/69esnh8Oh/fv3a8qUKTpz5ow2b96cpZoz8n47cOCA7r//fgUGBurll1+Wp6enPvroIzVv3lwbN25U48aNXR5z8uTJKl68uGJjY/XJJ5+ob9++qlChglq1anXb13vcuHGqWLGi8/bVq1fVv39/l3UyW8+tJCUlqXv37oqOjtaPP/7osnMtI6/jp59+6lw/9X2duv2SFBQUJCnz78/WrVurV69eLm316tWTJMXHx6t58+b69ddfNXDgQFWsWFFffvmlnnrqKV26dCnNmTsLFizQlStXNGDAAF2/fl1Tp05VixYttG/fPmd96Rk1apRLqEiVmc+0j4+PFi5cqHfffVeenp6S/j4Ne926dfLx8bnpc//Tli1b1KBBgzTte/fu1f333y9PT0/169dPFSpU0LFjx7RixQq9+eabGXpsd3rllVcytX65cuX09ttvu7StWrVKn3/+uUvbmDFjNHbsWLVq1Ur9+/fX4cOH9cEHH2jnzp368ccfna/rrVy7dk3x8fG6fPmyli9frv/973967LHHnMtPnz6tCxcuqFGjRmnue88992jVqlWZ2jbp789D+/btFRISotGjRyspKUkzZ85U06ZNtXPnTlWrVu2m901JSVHHjh21bt06Pf744xo8eLCuXLmiyMhI7d+/X61atXL57H311Vf6+uuvXdpu3MkzcOBAFS5cWGPGjHG+hidPntSGDRucO1qy+lrPnTtXI0aM0KRJk9SjRw9J0pNPPqlx48bpiy++cNlJnJiYqCVLlqh79+4un4GGDRtKkn788UfVr18/oy8zgFsxAOA2Ll++bEgyOnfunOH7SDIkGT/99JOz7eTJk4aPj4/RtWtXZ1ufPn2M0qVLGzExMS73f/zxx41ChQoZcXFxLu2vvfaaIcll/Vq1ahkPPPCAy3oPPPCAUatWrTR1vfvuu4Yk4/jx4862sLAwIzQ01HA4HM62uXPnGpKMnTt3Znq99PTu3dsoWLBgmvYvv/zSkGSsX7/e2fbpp58adrvd2Lx5s8u6H374oSHJ+PHHH51tkowBAwakedwOHToYISEhLm03vpaJiYlG7dq1jRYtWtyy9n86fvy4IcmYO3dummV79uwxJBnPPvusS/tLL71kSDK+//57Z1tISIjRu3dvl/V69Ohh+Pn5ZanmjL7funTpYnh5eRnHjh1ztp05c8YICAgwmjVr5mxL7dd/vk+OHDliSDImTpyYZtv/6WbviT/++MOQZIwePTrT9aTnn33hcDiMnj17Gn5+fsb27dvTrJvZvk9v+1O54/2ZasqUKYYk47PPPnOpLSwszPD39zdiY2NdttXX19f4/fffnetu377dkGQMGTLE2da7d2+X9/7+/fsNu91utGvXLsuf/ZCQEKN169ZG8eLFjSVLljjb33jjDePee+81QkJCjA4dOtx0Ow3DMJKSkgybzWa8+OKLaZY1a9bMCAgIME6ePOnS/s+6MqJgwYJpPle388ADD7h8f65atcqQZLRt29bIyM/EjH7XXrhwwfDy8jLCw8ONlJQU53r
"text/plain": [
"<Figure size 1200x800 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"average_prices = df.groupby('sub_category')['price'].mean().reset_index()\n",
"plt.figure(figsize=(12, 8))\n",
"plt.bar(average_prices['sub_category'], average_prices['price'], edgecolor='black', color='skyblue')\n",
"plt.title('Средняя цена товаров по категориям (с 1-й по 30-ю строку)')\n",
"plt.xlabel('Категория')\n",
"plt.ylabel('Средняя цена')\n",
"plt.xticks(rotation=90)\n",
"plt.grid(True)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Наиболее дорогие товары из категории Dairy & Bakery, а наиболее дешевые - из категории Fruits & Vegetables"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "aimenv",
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}