2024-09-27 00:19:23 +04:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"Импорт библиотек и загрузка датасета"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-10-25 16:37:49 +04:00
|
|
|
"execution_count": 2,
|
2024-09-27 00:19:23 +04:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stderr",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"<>:4: SyntaxWarning: invalid escape sequence '\\j'\n",
|
|
|
|
"<>:4: SyntaxWarning: invalid escape sequence '\\j'\n",
|
2024-10-25 16:37:49 +04:00
|
|
|
"C:\\Users\\MaD\\AppData\\Local\\Temp\\ipykernel_13404\\161500005.py:4: SyntaxWarning: invalid escape sequence '\\j'\n",
|
|
|
|
" df = pd.read_csv(\"../data\\jio_mart_items.csv\")\n"
|
2024-09-27 00:19:23 +04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"import pandas as pd\n",
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
|
"\n",
|
2024-10-25 16:37:49 +04:00
|
|
|
"df = pd.read_csv(\"../data\\jio_mart_items.csv\")"
|
2024-09-27 00:19:23 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"Изучение полученных данных"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-10-25 16:37:49 +04:00
|
|
|
"execution_count": 3,
|
2024-09-27 00:19:23 +04:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|
|
|
"RangeIndex: 162313 entries, 0 to 162312\n",
|
|
|
|
"Data columns (total 5 columns):\n",
|
|
|
|
" # Column Non-Null Count Dtype \n",
|
|
|
|
"--- ------ -------------- ----- \n",
|
|
|
|
" 0 category 162313 non-null object \n",
|
|
|
|
" 1 sub_category 162313 non-null object \n",
|
|
|
|
" 2 href 162313 non-null object \n",
|
|
|
|
" 3 items 162280 non-null object \n",
|
|
|
|
" 4 price 162282 non-null float64\n",
|
|
|
|
"dtypes: float64(1), object(4)\n",
|
|
|
|
"memory usage: 6.2+ MB\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"df.info()\n",
|
|
|
|
"\n",
|
|
|
|
"# print(df.describe().transpose())\n",
|
|
|
|
"\n",
|
|
|
|
"# cleared_df = df.drop([\"Name\", \"Ticket\", \"Embarked\"], axis=1)\n",
|
|
|
|
"# print(cleared_df.head())\n",
|
|
|
|
"# print(cleared_df.tail())\n",
|
|
|
|
"\n",
|
|
|
|
"# sorted_df = cleared_df.sort_values(by=\"Age\")\n",
|
|
|
|
"# print(sorted_df.head())\n",
|
|
|
|
"# print(sorted_df.tail())"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"Захотел посмотреть кол-во подкатегорий."
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-10-25 16:37:49 +04:00
|
|
|
"execution_count": 4,
|
2024-09-27 00:19:23 +04:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"72\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"print(len(set(df[\"sub_category\"])))\n",
|
|
|
|
"\n",
|
|
|
|
"# print(df.sort_values(by=\"category\")[[\"category\", \"sub_category\"]])\n",
|
|
|
|
"\n",
|
|
|
|
"# print(df.loc[100])\n",
|
|
|
|
"\n",
|
|
|
|
"# print(df.loc[100, \"Name\"])\n",
|
|
|
|
"\n",
|
|
|
|
"# print(df.loc[100:200, [\"Age\", \"Name\"]])\n",
|
|
|
|
"\n",
|
|
|
|
"# print(df[0:3])\n",
|
|
|
|
"\n",
|
|
|
|
"# print(df.iloc[0])\n",
|
|
|
|
"\n",
|
|
|
|
"# print(df.iloc[3:5, 0:2])\n",
|
|
|
|
"\n",
|
|
|
|
"# print(df.iloc[[3, 4], [0, 1]])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-10-25 16:37:49 +04:00
|
|
|
"execution_count": 5,
|
2024-09-27 00:19:23 +04:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA90AAAJOCAYAAACqS2TfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABfbklEQVR4nO3deXwNZ///8fdJZBMSexbSoFpiKUpvIrZWiK1otepGRauqSku1lC6WLndUSy21VLW0qnfVeiutfStS+1ZLLI3SkqBIaktIrt8fvpmfI0FCppH09Xw8zkPmmmvmfOacyznnfWbOjMMYYwQAAAAAALKdS04XAAAAAABAXkXoBgAAAADAJoRuAAAAAABsQugGAAAAAMAmhG4AAAAAAGxC6AYAAAAAwCaEbgAAAAAAbELoBgAAAADAJoRuAAAAAABsQugGAAAAAMAmhG4AwN/i0KFD6t69u8qWLStPT0/5+PgoLCxMo0eP1sWLF3O6PAAAAFvky+kCAAB538KFC/Xkk0/Kw8NDnTt3VuXKlZWcn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DBggb29vfffdd2rTpo1mz56txx57zKmud955R2XKlHFqK1KkiCRp2bJlatasmcqWLashQ4bo4sWLGjt2rMLCwrR169Z0X4a0a9dOpUuXVlRUlH7++WeNGTNGZ86c0VdffXXDx+Xs2bPpnosbWbNmjX744YdM9QUA3IQBAMAmCQkJRpJp3bp1ppeRZCSZzZs3W22//fab8fT0NI899pjV1rVrVxMQEGBOnTrltHz79u2Nr6+vuXDhglP7G2+8YSQ59a9UqZJp0KCBU78GDRqYSpUqpavrww8/NJJMbGys1RYaGmpCQkJMamqq1TZlyhQjyWzatCnL/TISGRlpvL2907XPnDnTSDIrV6602qZNm2ZcXFzMTz/95NR34sSJRpJZt26d1SbJ9OzZM916W7RoYYKDg53arn8sk5OTTeXKlc0jjzxy09qNyfzjeeLECePu7m6aNGliUlJSrH6ffPKJkWS++OKLm97P4MGDTdrHmsOHD5uAgABTt25dc/HixZtuizHGREdHG0nmq6++uuE2XD9O0jRq1MhUqVLFXLp0yWpLTU01derUMffdd5/Vlpnnu1q1aqZEiRLmzz//tNp27NhhXFxcTOfOndNta6tWrZyWf/HFF40ks2PHDqtNkhk8eLA13b9/f1OiRAlTo0YNp21auXJluvFUq1Yt06xZs3TrAABkDYeXAwBsk5iYKEkqWLBglpYLDQ1VjRo1rOl77rlHrVu31uLFi5WSkiJjjGbPnq1HH31UxhidOnXKukVERCghIUFbt251WmfaYbeenp63vP+UlBSndZ46dUoXLlxI1++vv/5S4cKF0x3WfLv97tTMmTMVEhKiChUqONX+yCOPSLp6uPW1Ll26lG47L1++nG69Xl5e1t9nzpxRQkKC6tWrl+4xvhPLli1TcnKy+vTpIxeX///xpFu3bvLx8dHChQsztZ4///xTERERKliwoObPn5/u+b52Wy5fvqw///xT5cqVU6FChbK8PadPn9aKFSvUrl07/fXXX9ZjmFbDgQMH9Mcff2RqXcePH9f27dvVpUsXa8+3JD3wwANq3Lhxhnuce/bs6TT90ksvSdIN907/8ccfGjt2rN5+++0Mf7JwrTlz5mjTpk0aNmx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0KFD9eKLL6Y74gEAcHv4TTcAwFb9+/eXt7e3nnvuOcXHx6ebf+jQIY0ePdqpLTo62un3tUePHtX//vc/NWnSRK6urnJ1dVXbtm01e/bsDPeinzx50ml6yZIlSkhIUOvWrbNpq/6/559/Xu7u7po8ebLCw8NVsWLFO+p3J9q1a6c//vgj3V566eph1efPn8/
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 1000x600 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"\n",
|
|
|
|
"avg_price_by_category = df.groupby('category')['price'].mean()\n",
|
|
|
|
"\n",
|
|
|
|
"plt.figure(figsize=(10, 6))\n",
|
|
|
|
"avg_price_by_category.plot(kind='bar', color='skyblue')\n",
|
|
|
|
"plt.title('Средняя цена по категории')\n",
|
|
|
|
"plt.xlabel('Категория')\n",
|
|
|
|
"plt.ylabel('Средняя цена')\n",
|
|
|
|
"plt.xticks(rotation=0)\n",
|
|
|
|
"plt.tight_layout()\n",
|
|
|
|
"plt.show()\n",
|
|
|
|
"\n",
|
|
|
|
"\n"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"Данная диаграмма отображает среднюю цену по категории и иллюстрирует очевидный факт: электроника и ювелирные украшения стоят больше всего."
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-10-25 16:37:49 +04:00
|
|
|
"execution_count": 6,
|
2024-09-27 00:19:23 +04:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAw0AAAL6CAYAAAB0Abr1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiw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Pr/rE6fPg1nZ+caj2tYWBimT59u/L6iogK33norunTpgqKiIpN9r+0eWP119c+k2p49ezBw4EA4OzvDw8MDY8eORUxMjMk+1c9dAGjVqhX69+8POzs7BAQE1Lj22lx9/2p79+6FQqHAk08+adyWnJyMp556Ch07doRSqYS3tzcmTJiApKSkG17b1V+rV6827n/p0iU88MAD8PLygqOjI/r164c//vijXo+XIAhIS0tr1GNV/Vrg5uYGb29vPPvss6isrDTZVxAEvPnmmybbPvzww+u+Xl37OI8ePbrWYxBR02FLA5FEqt/ge3t7AwASEhLw22+/YcKECWjTpg2ys7OxbNkyDB48GNHR0QgKCgIA6PV6jBkzBrt378aDDz6IZ599FqWlpfj7779x4cIFtGvXzniOyZMnY9SoUSbnfeWVV2qt591334UgCHjppZeQk5ODzz77DEOHDkVUVBSUSiWAqjcUjz76KG655RYsWrQI2dnZ+Pzzz3H48GGcOXPG+GnruXPnMHDgQNjb22PWrFkICwtDfHw8/vzzT7z77rsYN24cwsPDjed+7rnn0LlzZ8yaNcu4rXPnzsb/FxYWYtSoUZg4cSImT56MDRs24P/+7//g4OCAxx57DABQUlKClStXYvLkyXj88cdRWlqKb7/9FsOHD8fx48fRq1evBv+MDAYD7r33Xhw6dAizZs1C586dcf78eXz66ae4cuUKfvvttwYfsyEqKioQGRmJuLg4zJ49G23atMHGjRsxffp0FBUV4dlnnzXuO2PGDKxevRojR47EzJkzodPpcPDgQfzzzz/o168f1q5da9z34MGDWL58OT799FP4+PgAAPz9/Zu8/uLiYowcORL29vbYtm0bXFxcANT/Z9WnTx/88MMPGD9+PDp16lRrKBNFEVOnTkViYiKOHTt23U/8q7sHAsDHH3+MwsJCk9t37dqFkSNHom3btnjzzTdRUVGBL7/8EhERETh9+nStIaPaxx9/3OjxSWfPnsV9992HUaNGmQymPnHiBI4cOYIHH3wQrVq1QlJSEr755htERkYiOjoaTk5OGDRokMnP9d133wUAYzgHgAEDBgAALl68iIiICAQHB+Pll1+Gs7MzNmzYgPvuuw+//PIL7r///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AUBVC0FBQQF0Oh369etn8vhVKy8vR15ensmXXq832Wfjxo3o3LkzOnXqZLJfddeya7vTVFZW1jimVqut9Zrqc/5t27YhICDAZMyLvb095syZg7KyMuzfvx9A1XNCEAQsWLCgxnka+5iXlpYiLy+vRnef+jAYDJg6dSr++ecfbNu2zaT1C2j4z+qFF17AlClTMHHiRERHRxu3r127Fu+99x6WLVuGiIiIWmup7gZz9XP2WpmZmYiKisL06dONn6YDQI8ePTBs2LA6P8V+++234e7ujjlz5lx3n9rk5+dj+PDhcHV1xR9//FGjvurWPQDQarXIz89HeHg4PDw8an2M6lJQUIA9e/Zg4sSJxp9rXl6esYbY2NhauxjWpjGP1dNPP23yffVr1/Ue1/T0dHz55ZeYP3++sXXqejZv3owTJ05g8eLF9aqfiBqPoYGohSxZsgR///039u7di+joaCQkJGD48OHG2w0GAz799FO0b98eCoUCPj4+8PX1xblz51BcXGzcLz4+Hh07doSdXdP2Lmzfvr3J94IgIDw83NiHOjk5GQDQsWPHGvft1KmT8faEhAQAVf3zm0pQUBCcnZ1NtnXo0AEATPp4f//99+jRowccHR3h7e0NX19
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 800x800 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"category_counts = df['category'].value_counts()\n",
|
|
|
|
"\n",
|
|
|
|
"plt.figure(figsize=(8, 8))\n",
|
|
|
|
"plt.pie(category_counts, labels=category_counts.index, autopct='%1.1f%%', colors=plt.cm.Paired.colors)\n",
|
|
|
|
"plt.title('Распространенность каждой категории')\n",
|
|
|
|
"plt.tight_layout()\n",
|
|
|
|
"plt.show()\n",
|
|
|
|
"\n"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"Данная диаграмма отображает распространённость каждой категории"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-10-25 16:37:49 +04:00
|
|
|
"execution_count": 23,
|
2024-09-27 00:19:23 +04:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
2024-10-25 16:37:49 +04:00
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA/8AAAIjCAYAAABViau2AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACeo0lEQVR4nOzdeViU9f7/8dewgwQuxOIKoqamVmqJFKllmUrKQeuUZafSo6V2ci87HSuzPLlhi5ZoWae0RSU8YYue1MIkS8vM0nKB3Fg0FVRAtvn94W/mywgowjj3DD4f1+XV3Pfnxcx7OHOGec99fz63yWw2mwUAAAAAAOosN6MLAAAAAAAAlxbNPwAAAAAAdRzNPwAAAAAAdRzNPwAAAAAAdRzNPwAAAAAAdRzNPwAAAAAAdRzNPwAAAAAAdRzNPwAAAAAAdZyH0QUAAOBqCgsLdezYMXl4eCg4ONjocgAAAC6II/8AAFTD//73Pw0YMED169eXr6+vmjRposcff9zosgAAAKqF5h8A4DLefvttmUwm6z8fHx+1adNGY8aMUXZ29iV73AULFqhPnz7Kzc3Vyy+/rLVr12rt2rWaNm3aJXtMAAAAe+K0fwCAy5k2bZoiIiJUWFiojRs36vXXX9enn36qHTt2yM/Pz66PtXv3bo0fP14jRozQggULZDKZ7Hr/AAAAjkDzDwBwOX379lXXrl0lScOHD1ejRo00d+5crVq1Svfee69dH+uVV15RaGioXnnlFRp/AADgsjjtHwDg8m655RZJUnp6uiTp2LFjmjhxojp27Ch/f38FBASob9+++umnn2x+buPGjbrpppsUFBQkHx8ftWzZUk888YQKCwutmW+//VZdunTRqFGjFBISIm9vb3Xo0EGLFi2yua+MjAyZ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u3bt1LZtW5vfj2Vayvr166t9X59++qlCQ0Nt1rDw9PTUP/7xD506dUpfffWVTf5Cr7vKTJkyRZ07d9Zdd91VYezkyZNq0KBBtV5nXl5euu+++7RkyRLrvrffflsPPfTQBX8WAOA4nPYPAHA58+fPV5s2beTh4aGQkBBdddVV1mZfOts4v/zyy1qwYIHS09NVWlpqHbNMDSivffv21ksFPvjgg3r55ZetYyaTSW3atLG5f0lq166dJNnMk5ak1q1bV7j/Nm3a6KOPPpIk/fHHH5Kkq666qkKuXbt2+uKLL3T69GmdOnVKeXl56tChw3l/F7W1e/duSdLf/va3KjO5ublq0KCBdbuy2u3pyJEjys/Pr/J3VFZWpgMHDujqq68+7/0sXLjQukbA8ePHK82kpKRo+vTp2rZtm828/Jp8ubJ7927t3LlTV155ZaXjOTk51b6vP/74Q61bt67ydWd5HVlc6HV3ro0bN+qTTz7Rl19+qf3791cY7969uxYvXqyFCxcqNjZW3t7eOnXqVJX1PvTQQ+rSpYsyMzP1+++/KzMzU3fffbfNGgYAAGPR/AMAXM4NN9xQ6dFwixdffFH/+te/9PDDD+v5559Xw4YN5ebmprFjx1Y4ii2dPWKbl5enrVu36t///reaNGlibVrKHxmuiyy/j1mzZlnnm5/L39/fZnvlypUKCAiwbv/+++8aPXr0Jauxpr799lu98MIL+v777zVu3Djdcccd1nn60tn5+wMGDNDNN9+sBQsWKCwsTJ6enlqyZImWLVt20Y9XVlamjh07au7cuZWON2vWrMbPxd6eeOIJ9enTR7fcckulCzXOmDFDhw4d0iOPPFKt+7vmmmt0zTXX6D//+Y927typQYMG2bxGAADGo/kHANQ5K1asUK9evfTmm2/a7D9x4oRN82cRExMjSer
|
2024-09-27 00:19:23 +04:00
|
|
|
"text/plain": [
|
2024-10-25 16:37:49 +04:00
|
|
|
"<Figure size 1200x600 with 1 Axes>"
|
2024-09-27 00:19:23 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2024-10-25 16:37:49 +04:00
|
|
|
"categories = df['category'].unique()\n",
|
|
|
|
"data = [df[df['category'] == cat]['price'].dropna() for cat in categories]\n",
|
2024-09-27 00:19:23 +04:00
|
|
|
"\n",
|
2024-10-25 16:37:49 +04:00
|
|
|
"plt.figure(figsize=(12, 6))\n",
|
|
|
|
"plt.boxplot(data, vert=True, patch_artist=True, boxprops=dict(facecolor=\"lightblue\"))\n",
|
|
|
|
"\n",
|
|
|
|
"plt.title('Разброс цен по категориям')\n",
|
2024-09-27 00:19:23 +04:00
|
|
|
"plt.xlabel('Категория')\n",
|
2024-10-25 16:37:49 +04:00
|
|
|
"plt.ylabel('Цена')\n",
|
|
|
|
"\n",
|
|
|
|
"plt.ylim(0, 10000) \n",
|
|
|
|
"\n",
|
|
|
|
"plt.xticks(ticks=range(1, len(categories) + 1), labels=categories)\n",
|
|
|
|
"\n",
|
2024-09-27 00:19:23 +04:00
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
2024-10-25 16:37:49 +04:00
|
|
|
"Данная диаграмма отображает разброс цен по категориям"
|
2024-09-27 00:19:23 +04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
|
|
|
"display_name": "Python 3",
|
|
|
|
"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
|
|
|
|
}
|