AIM-PIbd-32-Petrushin-E-A/lab_1/lab1.ipynb

180 lines
132 KiB
Plaintext
Raw Permalink Normal View History

2024-09-13 23:36:05 +04:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Выгрузка в датафрейм\n"
]
},
{
"cell_type": "code",
2024-09-14 09:51:51 +04:00
"execution_count": 1,
2024-09-13 23:36:05 +04:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Index(['ID', 'Price', 'Levy', 'Manufacturer', 'Model', 'Prod. year',\n",
" 'Category', 'Leather interior', 'Fuel type', 'Engine volume', 'Mileage',\n",
" 'Cylinders', 'Gear box type', 'Drive wheels', 'Doors', 'Wheel', 'Color',\n",
" 'Airbags'],\n",
" dtype='object')\n"
]
}
],
"source": [
"import pandas as pn\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib\n",
"import matplotlib.ticker as ticker\n",
"df = pn.read_csv(\".//static//csv//car_price_prediction.csv\").head(15000)\n",
"print(df.columns)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"По диаграмме видно, что большинство авто были выпущены последние 20 лет"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Figure size 1000x600 with 0 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlUAAAHHCAYAAACWQK1nAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB5ZUlEQVR4nO3deXgURfoH8G/PPTkmB7kIBIii3IiAYEAOl0hUPFBWFFEOWWEFXJHfirIqIrqLyqqg4r2C54rsrqiASAQUhXAFkPu+jyTkmJxzT/3+mEybIZNkEjqZJHw/z5MH0l3TXe90T/KmqrpKEkIIEBEREdElUQW7AkRERETNAZMqIi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pfLhfXr1/uULysr8ymXm5tbZfO99z4xm811rl993ndVWblyJRISEjBq1Ch5m1arxV/+8heUlJTg559/9infs2dPdOnSRW55OXnyJNatW1epS8TlcmH16tUYPnw4rrjiCnl7y5Ytcf/99+PXX39FUVGRvD0+Ph4PPvig/L1arca0adNgs9nw448/+q17IPe+3W6HXq+v9j0oLi5GSEiIzz0fiNrGWF/Onz+PnTt3Yty4cXLLFQB0794dN910E1auXFnpNVarNaB4K96ThYWFyM3NxaBBg3Ds2DEUFhbW+Hq32y1/dnbu3IlPPvkELVu2rNRK7b2f8/Ly4HQ6azxuoFQqFUaPHo1vv/0WxcXF8vbPP/8c/fr1k1v+li1bBrfbjVmzZlW6l/z9TPvmm28wefJkPPHEE5g6dWql/bX5LDc
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Диаграмма рассеяния: Цена vs Год выпуска\n",
"plt.figure(figsize=(10, 6))\n",
"df.plot.scatter(x='Prod. year', y='Price', alpha=0.5)\n",
"plt.title('Зависимость цены автомобиля от года выпуска')\n",
"plt.xlabel('Год выпуска')\n",
"plt.ylabel('Цена')\n",
"plt.grid(True)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Большая чать машин дешевле 50000"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1sAAAI0CAYAAADr6TM+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABnaUlEQVR4nO3deXxN1/7/8feJzCFUDDFGKuaaVYUam1Cl2qK9VdTQ1nDRoqNbNd5WJ1PRaktF50u1tNoippqCVmm1Yqooghgjgszr94dfzteRVHM028mJ1/PxyONhr7XO3p99rIR39t7r2IwxRgAAA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AcffNCp1wEo+LiNEEChM2vWLFWvXl2enp4qW7asatSoYQ9X0uX/NE6fPl1vv/224uLiHP4DnH2roXT59sMaNWrI0zN/f1RWq1bNYdtmsyksLMz+nMa+ffskSX369PnLfZw7d0633HKLffvUqVM59nu1ffv2yRjzl+Ouvt0vMTFRkv7yP5XZ+zx37pzKlCmTa/+JEycctlesWKHSpUtfs86rjR07VuXLl9fAgQNzPIu0b98+xcbG/uU+rz7+P7Fv3z79+uuveT7W2LFjNXbs2BzjypYtm6fjzZ07V3Pnzs3RHhIS4rC9dOlS/fe//9WOHTscnlPLyy8EDh06pDFjxujrr7/O8YzduXPnHLYPHz7scO7lypXTokWLrjk/cvPnn3+qfPnyDr9wkGQPbbndHtivXz/169dPkydP1sKFC3X
"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')\n",
"plt.title('Распределение цен на автомобили')\n",
"plt.xlabel('Цена')\n",
"plt.ylabel('Количество автомобилей')\n",
"plt.grid(True)\n",
"\n",
"\n",
"# Увеличение количества делений на оси X\n",
"plt.xticks(rotation=20) \n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"На данном срезе авто марки \"Хёндай\" в среднем самые дорогие."
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA/8AAAMmCAYAAACjMzGxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACcRUlEQVR4nOzdd3gU5d7G8XsTUggQCCUJSAu9d4VQQ0soilSVIlWKwhGIAgIKAVSw0FQQkXoEjjQPKiAQOkhQKaGIoCAICAkKQqSlzvsHJ/uypJC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PxL0o0bN3T06FEVLFgw24S2/fv3q06dOpo8ebJee+01SdKtW7dUrFgx1atXT2vXrrW27dGjh9asWaNz585lm8/L7Cg+Pl5+fn4aMmSIJk6c6OxygDQ9Wsc2AbDLu+++q+vXr2v+/Pkpgr8klSlTxib4WywWDRkyREuXLlX58uXl6emp2rVra+fOnSme+/vvv6tv377WQw0rV66sBQsWpFpHWFiYLBZLip97/xELCgpSlSpVUjz//fffl8VisTmMMSEhQW+++abKlSsnDw8Pm+Xu27fP7nap6d27d6qHoK5atSrVw0hjY2M1fvx4lSlTRh4eHipWrJhGjhyp2NhYm3bJ2/leTz75pEqWLJli3evXr68CBQooZ86cql27tlatWpVu3cl27dqlLl26qHjx4tZ6hg8fnuJUj969e9tsFx8fHwUFBdn8I16yZMlUxzD55+66b9y4oVdeeUXFihWTh4eHypcvr/fff1/3fpec/NwZM2akqL1ChQqpbqdff/1VXbp0Uf78+eXl5aV69epp3bp1Nm327t2rGjVq6O2337bWULZsWU2ZMsV6bv3dNYSFhdlMe++991J9faa2rZJ/7l3G8ePH1blzZ+XPn1+enp6qU6eOvvrqK5s2ixYtsr6ufX19reNcrVo1WSwWLVq0KEX/qT0/rZ97azp48KBat24tb29v5c6dW82bN9fevXvT7UOSzpw5k24/d2+n7du3y2KxaPny5RozZoz8/f2VK1cutWvXTufOnUux7JUrV6p27drKmTOnChYsqB49eqQ4p7p3794p3hfnzp1Tzpw5U3wuPP300ypZsqQ8PT3l6+urdu3a6ciRIzbPvbt2V1dXPfbYYxowYICuXr1q0+7SpUvq16+f/Pz85OnpqerVq6d5SkZaY3Fv3RldF3veb0lJSZoxY4YqV64sT09P+fn5aeDAgfrrr79S1Jk8PverM/l9VqRIEbm4uFjb3f35fPeyIiMjbZ7/+++/y9XVVRaL5b6fV7dv39aGDRvUokWLVOcvWbJETzzxhLy8vOTj46PGjRtr06ZN6S4zT548yp8/f7pt0pP8ml+0aJFy5cqlunXrqnTp0ho8eLAsFot69+6doedn5D0j2fday4jk8bz7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NDKlSvVu3dvXb16Nc2jpe4ei6lTp6YawDOyLhl9v0nSwIEDrdvy5Zdf1unTp/XRRx/p4MGD+vbbb+Xm5paiz7uXNXfuXJ09e9Y6LzExUe3atdNvv/2mYcOGqVy5crJYLHrrrbdSrT/5PTxz5kzrtMWLF8vd3T3NMbrb/v37FRcXp1q1aqWYN2HCBIWFhal+/fqaOHGi3N3d9d1332nr1q0KDg6+77Iz08mTJ/Xpp5/a9ZyMvGce9LV2r8uXLysxMVFnz5617llu3ry5df7BgwclSXXq1LF5Xu3ateXi4qKDBw+qR48edq3f4MGD9emnn6pdu3Z69dVXdfDgQb333ns6evSo1q1bJ4vFkuZzDx8+rEaNGsnNzU0DBgxQyZIlderUKX399dd666231LFjR5UpU8bafvjw4apYsaIGDBhgnZb8Gpakv/76S23atNE
"text/plain": [
"<Figure size 1200x800 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Срез данных: с 1-й по 30-ю строку\n",
"df_slice = df.iloc[:30]\n",
"\n",
"# Группировка по производителю и расчет средней цены\n",
"avg_price_by_manufacturer = df_slice.groupby('Manufacturer')['Price'].mean().sort_values(ascending=False)\n",
"\n",
"# Столбчатая диаграмма: Средняя цена по производителям\n",
"plt.figure(figsize=(12, 8))\n",
"avg_price_by_manufacturer.plot(kind='bar', color='salmon')\n",
"plt.title('Средняя цена автомобилей по производителям (с 1-й по 30-ю строку)')\n",
"plt.xlabel('Производитель')\n",
"plt.ylabel('Средняя цена')\n",
"plt.grid(True)\n",
"plt.show()"
]
}
],
"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.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}