255 lines
222 KiB
Plaintext
255 lines
222 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с данными - чтение и запись CSV"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 1,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"import pandas as pd\n",
|
|||
|
"import matplotlib.pyplot as plt\n",
|
|||
|
"\n",
|
|||
|
"df = pd.read_csv(\"data/Economic.csv\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 9,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|||
|
"RangeIndex: 369 entries, 0 to 368\n",
|
|||
|
"Data columns (total 14 columns):\n",
|
|||
|
" # Column Non-Null Count Dtype \n",
|
|||
|
"--- ------ -------------- ----- \n",
|
|||
|
" 0 stock index 369 non-null object \n",
|
|||
|
" 1 country 369 non-null object \n",
|
|||
|
" 2 year 369 non-null float64\n",
|
|||
|
" 3 index price 317 non-null float64\n",
|
|||
|
" 4 log_indexprice 369 non-null float64\n",
|
|||
|
" 5 inflationrate 326 non-null float64\n",
|
|||
|
" 6 oil prices 369 non-null float64\n",
|
|||
|
" 7 exchange_rate 367 non-null float64\n",
|
|||
|
" 8 gdppercent 350 non-null float64\n",
|
|||
|
" 9 percapitaincome 368 non-null float64\n",
|
|||
|
" 10 unemploymentrate 348 non-null float64\n",
|
|||
|
" 11 manufacturingoutput 278 non-null float64\n",
|
|||
|
" 12 tradebalance 365 non-null float64\n",
|
|||
|
" 13 USTreasury 369 non-null float64\n",
|
|||
|
"dtypes: float64(12), object(2)\n",
|
|||
|
"memory usage: 40.5+ KB\n",
|
|||
|
" count mean std min 25% \\\n",
|
|||
|
"year 369.0 2000.000000 11.848225 1980.00 1990.00 \n",
|
|||
|
"index price 317.0 7898.648297 7811.336862 168.61 2407.10 \n",
|
|||
|
"log_indexprice 369.0 3.610542 0.482481 2.23 3.32 \n",
|
|||
|
"inflationrate 326.0 0.041748 0.039579 -0.04 0.02 \n",
|
|||
|
"oil prices 369.0 39.743171 25.452654 11.35 19.41 \n",
|
|||
|
"exchange_rate 367.0 27.897548 49.620521 0.90 1.33 \n",
|
|||
|
"gdppercent 350.0 0.037114 0.037850 -0.11 0.02 \n",
|
|||
|
"percapitaincome 368.0 20719.964674 17435.037783 27.00 2090.25 \n",
|
|||
|
"unemploymentrate 348.0 0.068908 0.043207 0.02 0.04 \n",
|
|||
|
"manufacturingoutput 278.0 328.084820 622.395923 0.59 80.38 \n",
|
|||
|
"tradebalance 365.0 -15.996384 154.557170 -770.93 -25.37 \n",
|
|||
|
"USTreasury 369.0 0.059024 0.033086 0.01 0.03 \n",
|
|||
|
"\n",
|
|||
|
" 50% 75% max \n",
|
|||
|
"year 2000.00 2010.0000 2020.00 \n",
|
|||
|
"index price 5160.10 10279.5000 47751.33 \n",
|
|||
|
"log_indexprice 3.60 3.9800 4.68 \n",
|
|||
|
"inflationrate 0.03 0.0575 0.24 \n",
|
|||
|
"oil prices 28.52 57.8800 98.56 \n",
|
|||
|
"exchange_rate 5.44 15.0550 249.05 \n",
|
|||
|
"gdppercent 0.03 0.0600 0.15 \n",
|
|||
|
"percapitaincome 19969.50 36384.0000 65280.00 \n",
|
|||
|
"unemploymentrate 0.06 0.0900 0.26 \n",
|
|||
|
"manufacturingoutput 188.16 271.9775 3868.46 \n",
|
|||
|
"tradebalance -0.14 19.0800 366.14 \n",
|
|||
|
"USTreasury 0.05 0.0800 0.14 \n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.info()\n",
|
|||
|
"print(df.describe().transpose())"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Данный график представляет собой гистограмму со средней инфляцией каждой страны за 40 лет."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 2,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"['United States of America' 'United Kingdom' 'India' 'Japan' 'Hong Kong'\n",
|
|||
|
" 'China' 'Germany' 'France' 'Spain']\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA9cAAAJOCAYAAAC9afQWAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACqI0lEQVR4nOzdeZxO9f//8ec1YxY7YWZs2bNnX8YSaRgljMr2sSeiiEbWRFJps1SUZGkVEaIkTJQisqSULZV9hrGNJWPMvH5/+M31dTVDM66ZuWZ43G+3uXG9z/uc8zrX+zrXdV7nvM/7OMzMBAAAAAAAbpiXpwMAAAAAACCrI7kGAAAAAMBNJNcAAAAAALiJ5BoAAAAAADeRXAMAAAAA4CaSawAAAAAA3ERyDQAAAACAm0iuAQAAAABwE8k1AAAAAABuIrkGAABIZ5s2bZKvr6/279/v6VBuOSNGjFC9evU8HQaAWwDJNQD8y759+/Too4+qdOnS8vf3V548edSwYUO9/vrr+ueffzwd3i1v8+bNcjgceu+99zwdCpBiTz/9tDp37qwSJUo4yzZt2qTHHntMtWrVko+PjxwOxzXnj4qKUq9evRQQEKDs2bOrZs2aWrBgQbJ1V69erbvvvlsFCxZUvnz5VLduXX344YfJ1p01a5YqVqwof39/lStXTm+++WaKtichIUHvvfee2rRpo+LFiytnzpyqUqWKnn/+eV28ePGG17Vo0SJ17NhRpUuXVo4cOVS+fHkNGTJEp0+fTnaZS5cuVc2aNeXv76/bb79dY8eO1eXLl13qDB48WNu3b9fSpUtTtG0AcKNIrgHgKl9++aWqVq2qTz/9VK1bt9abb76pCRMm6Pbbb9fQoUM1aNAgT4cIIIv5+eeftXr1avXr18+lfPny5Zo5c6YcDodKly59zfljYmLUqFEjffbZZ3r00Uf12muvKXfu3OrQoYPmzp3rUnfp0qVq0aKFLl26pGeffVYvvPCCsmfPru7du2vy5Mkudd955x098sgjqly5st58800FBwfriSee0Msvv/yf23ThwgX16tVLx48fV79+/TRlyhTVrVtXY8eO1b333iszu6F19e3bVzt37lTXrl31xhtvqGXLlpo6daqCg4OTnNz86quvFBYWpnz58unNN99UWFiYnn/+eQ0cONClXlBQkNq2bavXXnvtP7cLANxiAAAzM/vzzz8tV65cVqFCBTty5EiS6Xv37rUpU6Z4IDJc7aeffjJJNmfOHE+HAqTIE088YbfffrslJCS4lEdGRtqFCxfMzOzxxx+3ax2WvfLKKybJIiIinGXx8fFWp04dCwoKstjYWGd58+bNrUiRInbx4kVnWVxcnJUpU8buvPNOZ9mFCxesQIEC1qpVK5d1denSxXLmzGknT5687jbFxsbaDz/8kKR83LhxJslWrVp1Q+tas2ZNkmW+//77Jsneffddl/JKlSpZtWrVLC4uzln29NNPm8PhsJ07d7rUXbhwoTkcDtu3b991twsA3MGVawD4/1555RWdO3dOs2bNUuHChZNML1u2rMuVa4fDoQEDBujjjz9W+fLl5e/vr1q1aum7775LMu/hw4f18MMPKzAwUH5+fqpcubJmz56dbBzPPvusHA5Hkr+mTZu61GvatKmqVKmSZP7XXntNDodDf//9t7Ps8uXLev7553XHHXfIz8/PZbmbN29Odb3k9OzZUyVLlnQpO3jwoLJnz54knpIlS+r+++9PsowBAwYk6RobHR2ttm3bKnv27Kpbt67++usvSVeu5rVu3VrZs2dXo0aNtG/fviTLW7t2bbLv5b/j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atOmTapevXqK3p+rpXaZ/v7+mjNnjsLCwpxlixYtSvHn+vDhwzpw4IBq1qyZ6lgTxcbGJpuE58iRQ5K0ZcsWNW/eXNKV5PTll1/WM888ox49esjhcGju3LnavHmzPv30U+e827ZtkyTVrl3bZZm1atWSl5eXtm3bpq5du6Y61sjISElSwYIF02xdqVlmkSJFVKxYMef0RHnz5lWZMmX0ww8/6Mknn0ztZgFAynj60jkAZAZnzpwxSda2bdsUzyPJJNnmzZudZfv37zd/f39r166ds6x3795WuHBhi46Odpm/U6dOljdvXme30ESjRo0ySS71K1eubE2aNHGp16RJE6tcuXKSuF599VWTZH/99ZezLDg42CpWrOjSLXXOnDkmyX766adU10tOjx49rESJEs7XO3bsMC8vL7v33nuTxFOiRIkkXUTNknaN3bp1q0myd955x1k2depUk2T9+/d3ln399dcmyRYvXuyyvFWrVpkk+/bbb68Z5+7du02STZgwwWXef7+/a9asMUm2YMGCJHHnzJnTevTo4VJWokQJl7K33nrL/Pz87O6773ZZ/z///GNeXl726KOPuszfo0cPy5kzZ5J1/VtK38uff/7ZJNkjjzziUu+pp54ySfbNN99cdz133XWX5c6d2/bv3+9S/u+uzlfH9e/3JFGTJk1Mkk2cONFZFhsba9WrV7eAgAC7dOmSmZldvnzZpcuzmdmpU6csMDDQHn74YWfZX3/9ZZLs1VdfTbKuf+87qV1m586dLVu2bBYZGemcds8999j//ve/a67zaqtXrzZJtmzZsuvWu1638IEDB5qXl5f9/fffLuWdOnUySTZgwABn2blz56xDhw7mcDic31E5cuSwJUuWJFmft7d3susrVKiQderU6brxXktISIjlyZPHTp06lWbr6t27t3l7e9uePXucZYnfcwcOHEhSv06dOla/fv0k5S1atLCKFSumcEsAIPXoFg4AunI1S5Jy586dqvmCg4NVq1Yt5+vbb79dbdu21ddff634+HiZmT777DO1bt1aZqbo6GjnX2hoqM6cOZPk6mTiFTF/f///XH98fLzLMqOjo3XhwoUk9c6ePevsxno9Ka2XEiNHjlTNmjXVvn37ZKfHxcUlif3fVwMjIiIkSQ888ICzLPG
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1000x600 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"s_values = df[\"country\"].unique()\n",
|
|||
|
"print(s_values)\n",
|
|||
|
"\n",
|
|||
|
"average_inflation = df.groupby('country')['inflationrate'].mean()\n",
|
|||
|
"\n",
|
|||
|
"# Создание гистограммы\n",
|
|||
|
"plt.figure(figsize=(10, 6))\n",
|
|||
|
"average_inflation.plot(kind='bar', color='skyblue')\n",
|
|||
|
"plt.title('Средняя инфляция по странам (1980-2020)')\n",
|
|||
|
"plt.xlabel('Страны')\n",
|
|||
|
"plt.ylabel('Средняя инфляция (%)')\n",
|
|||
|
"plt.xticks(rotation=45)\n",
|
|||
|
"plt.grid(axis='y')\n",
|
|||
|
"\n",
|
|||
|
"# Показываем график\n",
|
|||
|
"plt.tight_layout()\n",
|
|||
|
"plt.show()\n",
|
|||
|
"\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Данный график представляет собой точечную диаграмма, на которой указаны соотношение цен на бензин и дохода на душу населения только Китая за 40 лет."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 3,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAxMAAAJOCAYAAADMPVrNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd1hTdxcH8G/CFgHFgaC4N4ri3loXbq2zddTaOlq1zmrdq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LwsLCjNbr1auXkilTJiU8PDze4wBQACgHDx402F+JEiWUXLlyKZGRkYqiKMrKlSsVtVqtHDlyxGD7xYsXKwCUY8eOGewzMX+fpvTu3VvJnDlzzP0DBw4Y/W1UrlxZady4sQJAGTt2bMxyc95LU5YvX27w2oaHhyt58+aNOVZC22t17NjR4DkoiqI4OjoqXbt2jblvzvdCdHS0UqNGDcXNzU0JCgpS+vTpo1hbWyunT59O0v4URVEiIyMVAErfvn1jlpn6HL5//16JiIgw2PbVq1eKm5ub8tVXXyX4WpjzOTD1d+zr66sULFgw5v7r168VJycnpXLlysq7d+8M1tVoNDG3RYoUUXx9fWOWafdfoEABpUGDBkbHyZ07t9KtW7eY+7H/7tL6e05RFMXd3V3x9fU1WBbX33xsNWrUUMqXL2+0XPs8/fz8lEqVKikAFC8vLyUqKsrkfrp27WrwGb58+bKiVqtjPiP630uxj6H/vPXFft8jIyOVUqVKKXXr1jV
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x600 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"china_data = df[df['country'] == 'China']\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"# Создание диаграммы разброса\n",
|
|||
|
"plt.figure(figsize=(8, 6))\n",
|
|||
|
"plt.scatter(china_data['percapitaincome'], china_data['oil prices'], color='red', alpha=0.8)\n",
|
|||
|
"\n",
|
|||
|
"# Добавляем подписи и заголовок\n",
|
|||
|
"plt.title('Соотношение цен на бензин и дохода населения (Китай)')\n",
|
|||
|
"plt.xlabel('Доход населения (в условных единицах)')\n",
|
|||
|
"plt.ylabel('Цена на бензин (в условных единицах)')\n",
|
|||
|
"\n",
|
|||
|
"# Настраиваем сетку\n",
|
|||
|
"plt.grid(True)\n",
|
|||
|
"\n",
|
|||
|
"# Добавляем аннотацию для Китая\n",
|
|||
|
"for i in range(len(china_data)):\n",
|
|||
|
" plt.annotate(china_data['year'].iloc[i], (china_data['percapitaincome'].iloc[i], china_data['oil prices'].iloc[i]), fontsize=12, color='blue')\n",
|
|||
|
"\n",
|
|||
|
"# Показываем график\n",
|
|||
|
"plt.tight_layout()\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Данный график представляет собой график с маркерами курса валюты Индии к USD за 40 лет"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 4,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKYAAAJOCAYAAACN2Q8zAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAADOLUlEQVR4nOzdd1yV9fvH8fdhCDJVXCiIMzVHlpqSIS7ciSGaaTnbaqjtsrRsmeXIbKlpDnIgWVbiSFIyNbNy5MwBTkxFUVGEw/37wx/nKwF6MOAc4PXswaPOfX/OfV0XiMnlZ5gMwzAEAAAAAAAAFDIHWycAAAAAAACAkonGFAAAAAAAAGyCxhQAAAAAAABsgsYUAAAAAAAAbILGFAAAAAAAAGyCxhQAAAAAAABsgsYUAAAAAAAAbILGFAAAAAAAAGyCxhQAAAAAAABsgsYUAACADXTt2lWPPvqoTXOIiYmRh4eH/vnnH5vmYW/ee+891atXTxkZGbZOpcRp2bKlnn/+eVunAQAoRDSmAAB2bc6cOTKZTPrtt9+y3ZsxY4ZMJpN69uwps9lsg+zwX/z0008ymUyKiorKdm/cuHEymUzy8PCwQWYFb8OGDVq1apVeeOEFy7WcPh+Zv/5dXV117NixbM9p06aNGjZsmOVa9erVZTKZLB/u7u66++67NXfu3Gzv79y5s2rXrq133nknH6vL2Y2+lyWpe/fuql69epZrFy9e1NixY9WwYUO5u7vLx8dHTZo0UUREhI4fP24Zl/nrJfPDzc1N1apV03333afZs2crNTXV6jyTk5M1YcIEvfDCC3Jw+N8flRctWqSHHnpIderUkclkUps2bXJ9xtatW9W5c2d5eXnJ09NTHTt21J9//pltXEZGhj799FM1adJEHh4eqlSpkrp06aJffvkl29jU1FS98MILqlKlikqXLq0WLVpo9erVVtV05swZTZw4Ua1bt1aFChVUpkwZtWzZUosWLcpxvDWxUlJSNH36dHXs2FG+vr7y9PTUnXfeqU8++STH348zMjL03nvvqUaNGnJ1dVXjxo311VdfZRv3wgsvaPr06Tp58qRVtQEAij4aUwCAIunrr7/Wk08+qaCgIC1cuFCOjo62Tgn55Ny5c5oyZYqt0yhQEydOVPv27VW7dm2rxqempurdd9+1+vlNmjTRvHnzNG/ePI0bN07nz5/XwIEDNWPGjGxjH3/8cX322We6cOGC1c8vDGlpaWrdurUmTpyooKAgTZo0SS+//LLuuusuRUZGat++fdne88knn2jevHmaNm2aHnnkEZ09e1ZDhgzR3XffrSNHjlgV94svvlB6eroefPDBbM/+5ptv5O/vr7Jly+b6/t9//1333nuvDh48qLFjx+q1117T/v37FRwcrL1792YZ+9xzz+nJJ59Uo0aNNGnSJD3zzDPat2+fgoOD9euvv2YZO2jQIE2aNEn9+/fX1KlT5ejoqK5du+rnn3++aU0bN27UK6+8onLlymnMmDF666235Obmpr59+2rs2LHZxlsT6+DBgxoxYoQMw9Do0aP1/vvvq0aNGnrqqac0ZMiQbM985ZVX9MILLygkJETTpk1TtWrV1K9fPy1cuDDLuNDQUHl5eenjjz++aV0AgGLCAADAjs2ePduQZGzZssVyLTY21nBxcTEaNWpknDt3zobZ4b+IjY01JBlLlizJcn3cuHGGJOOOO+4w3N3dbZRdwUlMTDScnJyMmTNnZrme0+cj89d/kyZNDBcXF+PYsWNZ3hMcHGw0aNAgy7WAgACjW7duWa6dOnXK8PDwMOrXr59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2CgoKUvfu3a3OMVPmDL+cZoxdb8+ePZKuNQJ
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1200x600 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"india_data = df[df['country'] == 'India']\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"# Создание диаграммы временных рядов\n",
|
|||
|
"plt.figure(figsize=(12, 6))\n",
|
|||
|
"plt.plot(india_data['year'], india_data['exchange_rate'], marker='o', color='green', linestyle='-')\n",
|
|||
|
"\n",
|
|||
|
"# Добавляем подписи и заголовок\n",
|
|||
|
"plt.title('Курс валюты Индии (INR) к USD (1980-2020)')\n",
|
|||
|
"plt.xlabel('Год')\n",
|
|||
|
"plt.ylabel('Курс (INR к USD)')\n",
|
|||
|
"\n",
|
|||
|
"# Настраиваем сетку\n",
|
|||
|
"plt.grid(True)\n",
|
|||
|
"\n",
|
|||
|
"# Показываем график\n",
|
|||
|
"plt.xticks(india_data['year'], rotation=45)\n",
|
|||
|
"plt.tight_layout()\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"metadata": {
|
|||
|
"kernelspec": {
|
|||
|
"display_name": "aimvenv",
|
|||
|
"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
|
|||
|
}
|