907 lines
213 KiB
Plaintext
907 lines
213 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с NumPy"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 1,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"matrix = \n",
|
|||
|
" [[4 5 0]\n",
|
|||
|
" [9 9 9]] \n",
|
|||
|
"\n",
|
|||
|
"tmatrix = \n",
|
|||
|
" [[4 9]\n",
|
|||
|
" [5 9]\n",
|
|||
|
" [0 9]] \n",
|
|||
|
"\n",
|
|||
|
"vector = \n",
|
|||
|
" [4 5 0 9 9 9] \n",
|
|||
|
"\n",
|
|||
|
"tvector = \n",
|
|||
|
" [[4]\n",
|
|||
|
" [5]\n",
|
|||
|
" [0]\n",
|
|||
|
" [9]\n",
|
|||
|
" [9]\n",
|
|||
|
" [9]] \n",
|
|||
|
"\n",
|
|||
|
"list_matrix = \n",
|
|||
|
" [array([4, 5, 0]), array([9, 9, 9])] \n",
|
|||
|
"\n",
|
|||
|
"matrix as str = \n",
|
|||
|
" [[4 5 0]\n",
|
|||
|
" [9 9 9]] \n",
|
|||
|
"\n",
|
|||
|
"matrix type is <class 'numpy.ndarray'> \n",
|
|||
|
"\n",
|
|||
|
"vector type is <class 'numpy.ndarray'> \n",
|
|||
|
"\n",
|
|||
|
"list_matrix type is <class 'list'> \n",
|
|||
|
"\n",
|
|||
|
"str_matrix type is <class 'str'> \n",
|
|||
|
"\n",
|
|||
|
"formatted_vector = \n",
|
|||
|
" 4; 5; 0; 9; 9; 9 \n",
|
|||
|
"\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"import numpy as np\n",
|
|||
|
"\n",
|
|||
|
"matrix = np.array([[4, 5, 0], [9, 9, 9]])\n",
|
|||
|
"print(\"matrix = \\n\", matrix, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"tmatrix = matrix.T\n",
|
|||
|
"print(\"tmatrix = \\n\", tmatrix, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"vector = np.ravel(matrix)\n",
|
|||
|
"print(\"vector = \\n\", vector, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"tvector = np.reshape(vector, (6, 1))\n",
|
|||
|
"print(\"tvector = \\n\", tvector, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"list_matrix = list(matrix)\n",
|
|||
|
"print(\"list_matrix = \\n\", list_matrix, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"str_matrix = str(matrix)\n",
|
|||
|
"print(\"matrix as str = \\n\", str_matrix, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"print(\"matrix type is\", type(matrix), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"print(\"vector type is\", type(vector), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"print(\"list_matrix type is\", type(list_matrix), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"print(\"str_matrix type is\", type(str_matrix), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"formatted_vector = \"; \".join(map(str, vector))\n",
|
|||
|
"print(\"formatted_vector = \\n\", formatted_vector, \"\\n\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с Pandas DataFrame\n",
|
|||
|
"\n",
|
|||
|
"https://pandas.pydata.org/docs/user_guide/10min.html"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с данными - чтение и запись CSV"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 3,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"import pandas as pd\n",
|
|||
|
"\n",
|
|||
|
"df = pd.read_csv(\"../data/car_price_prediction.csv\")\n",
|
|||
|
"\n",
|
|||
|
"df.to_csv(\"../data/test.csv\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с данными - основные команды"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 70,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|||
|
"RangeIndex: 19237 entries, 0 to 19236\n",
|
|||
|
"Data columns (total 18 columns):\n",
|
|||
|
" # Column Non-Null Count Dtype \n",
|
|||
|
"--- ------ -------------- ----- \n",
|
|||
|
" 0 ID 19237 non-null int64 \n",
|
|||
|
" 1 Price 19237 non-null int64 \n",
|
|||
|
" 2 Levy 19237 non-null object \n",
|
|||
|
" 3 Manufacturer 19237 non-null object \n",
|
|||
|
" 4 Model 19237 non-null object \n",
|
|||
|
" 5 Prod. year 19237 non-null int64 \n",
|
|||
|
" 6 Category 19237 non-null object \n",
|
|||
|
" 7 Leather interior 19237 non-null object \n",
|
|||
|
" 8 Fuel type 19237 non-null object \n",
|
|||
|
" 9 Engine volume 19237 non-null object \n",
|
|||
|
" 10 Mileage 19237 non-null object \n",
|
|||
|
" 11 Cylinders 19237 non-null float64\n",
|
|||
|
" 12 Gear box type 19237 non-null object \n",
|
|||
|
" 13 Drive wheels 19237 non-null object \n",
|
|||
|
" 14 Doors 19237 non-null object \n",
|
|||
|
" 15 Wheel 19237 non-null object \n",
|
|||
|
" 16 Color 19237 non-null object \n",
|
|||
|
" 17 Airbags 19237 non-null int64 \n",
|
|||
|
"dtypes: float64(1), int64(4), object(13)\n",
|
|||
|
"memory usage: 2.6+ MB\n",
|
|||
|
" count mean std min 25% \\\n",
|
|||
|
"ID 19237.0 4.557654e+07 936591.422799 20746880.0 45698374.0 \n",
|
|||
|
"Price 19237.0 1.855593e+04 190581.269684 1.0 5331.0 \n",
|
|||
|
"Prod. year 19237.0 2.010913e+03 5.668673 1939.0 2009.0 \n",
|
|||
|
"Cylinders 19237.0 4.582991e+00 1.199933 1.0 4.0 \n",
|
|||
|
"Airbags 19237.0 6.582627e+00 4.320168 0.0 4.0 \n",
|
|||
|
"\n",
|
|||
|
" 50% 75% max \n",
|
|||
|
"ID 45772308.0 45802036.0 45816654.0 \n",
|
|||
|
"Price 13172.0 22075.0 26307500.0 \n",
|
|||
|
"Prod. year 2012.0 2015.0 2020.0 \n",
|
|||
|
"Cylinders 4.0 4.0 16.0 \n",
|
|||
|
"Airbags 6.0 12.0 16.0 \n",
|
|||
|
" ID Price Levy Manufacturer Model Prod. year Category \\\n",
|
|||
|
"0 45654403 13328 1399 LEXUS RX 450 2010 Jeep \n",
|
|||
|
"1 44731507 16621 1018 CHEVROLET Equinox 2011 Jeep \n",
|
|||
|
"2 45774419 8467 - HONDA FIT 2006 Hatchback \n",
|
|||
|
"3 45769185 3607 862 FORD Escape 2011 Jeep \n",
|
|||
|
"4 45809263 11726 446 HONDA FIT 2014 Hatchback \n",
|
|||
|
"\n",
|
|||
|
" Fuel type Engine volume Mileage Cylinders Gear box type Drive wheels \\\n",
|
|||
|
"0 Hybrid 3.5 186005 km 6.0 Automatic 4x4 \n",
|
|||
|
"1 Petrol 3 192000 km 6.0 Tiptronic 4x4 \n",
|
|||
|
"2 Petrol 1.3 200000 km 4.0 Variator Front \n",
|
|||
|
"3 Hybrid 2.5 168966 km 4.0 Automatic 4x4 \n",
|
|||
|
"4 Petrol 1.3 91901 km 4.0 Automatic Front \n",
|
|||
|
"\n",
|
|||
|
" Doors Wheel Airbags \n",
|
|||
|
"0 04-May Left wheel 12 \n",
|
|||
|
"1 04-May Left wheel 8 \n",
|
|||
|
"2 04-May Right-hand drive 2 \n",
|
|||
|
"3 04-May Left wheel 0 \n",
|
|||
|
"4 04-May Left wheel 4 \n",
|
|||
|
" ID Price Levy Manufacturer Model Prod. year Category \\\n",
|
|||
|
"19232 45798355 8467 - MERCEDES-BENZ CLK 200 1999 Coupe \n",
|
|||
|
"19233 45778856 15681 831 HYUNDAI Sonata 2011 Sedan \n",
|
|||
|
"19234 45804997 26108 836 HYUNDAI Tucson 2010 Jeep \n",
|
|||
|
"19235 45793526 5331 1288 CHEVROLET Captiva 2007 Jeep \n",
|
|||
|
"19236 45813273 470 753 HYUNDAI Sonata 2012 Sedan \n",
|
|||
|
"\n",
|
|||
|
" Fuel type Engine volume Mileage Cylinders Gear box type \\\n",
|
|||
|
"19232 CNG 2.0 Turbo 300000 km 4.0 Manual \n",
|
|||
|
"19233 Petrol 2.4 161600 km 4.0 Tiptronic \n",
|
|||
|
"19234 Diesel 2 116365 km 4.0 Automatic \n",
|
|||
|
"19235 Diesel 2 51258 km 4.0 Automatic \n",
|
|||
|
"19236 Hybrid 2.4 186923 km 4.0 Automatic \n",
|
|||
|
"\n",
|
|||
|
" Drive wheels Doors Wheel Airbags \n",
|
|||
|
"19232 Rear 02-Mar Left wheel 5 \n",
|
|||
|
"19233 Front 04-May Left wheel 8 \n",
|
|||
|
"19234 Front 04-May Left wheel 4 \n",
|
|||
|
"19235 Front 04-May Left wheel 4 \n",
|
|||
|
"19236 Front 04-May Left wheel 12 \n",
|
|||
|
" ID Price Levy Manufacturer Model Prod. year Category \\\n",
|
|||
|
"7815 45765530 1 - OPEL Astra 1999 Sedan \n",
|
|||
|
"16992 45772201 1 1202 CHEVROLET Lacetti 2006 Hatchback \n",
|
|||
|
"4776 45687380 3 810 VOLKSWAGEN Jetta 2016 Sedan \n",
|
|||
|
"13419 45816352 3 503 TOYOTA Prius C 2012 Hatchback \n",
|
|||
|
"14642 45816369 3 87 PORSCHE Panamera 2011 Sedan \n",
|
|||
|
"\n",
|
|||
|
" Fuel type Engine volume Mileage Cylinders Gear box type \\\n",
|
|||
|
"7815 Petrol 1.6 122231 km 4.0 Manual \n",
|
|||
|
"16992 Petrol 1.6 200000 km 4.0 Manual \n",
|
|||
|
"4776 Petrol 1.8 Turbo 41000 km 4.0 Automatic \n",
|
|||
|
"13419 Petrol 1.5 172800 km 4.0 Automatic \n",
|
|||
|
"14642 Petrol 0 196800 km 6.0 Automatic \n",
|
|||
|
"\n",
|
|||
|
" Drive wheels Doors Wheel Airbags \n",
|
|||
|
"7815 Front 04-May Left wheel 4 \n",
|
|||
|
"16992 Front 04-May Left wheel 2 \n",
|
|||
|
"4776 Front 04-May Left wheel 8 \n",
|
|||
|
"13419 Front 04-May Left wheel 12 \n",
|
|||
|
"14642 Rear 04-May Left wheel 12 \n",
|
|||
|
" ID Price Levy Manufacturer Model Prod. year \\\n",
|
|||
|
"14839 45792307 297930 - LAND ROVER Range Rover Vogue 2019 \n",
|
|||
|
"5008 45810285 308906 1694 PORSCHE 911 2016 \n",
|
|||
|
"1225 45795524 627220 - MERCEDES-BENZ G 65 AMG 63AMG 2020 \n",
|
|||
|
"8541 45761204 872946 2067 LAMBORGHINI Urus 2019 \n",
|
|||
|
"16983 45812886 26307500 - OPEL Combo 1999 \n",
|
|||
|
"\n",
|
|||
|
" Category Fuel type Engine volume Mileage Cylinders Gear box type \\\n",
|
|||
|
"14839 Jeep Diesel 3.0 Turbo 4500 km 8.0 Tiptronic \n",
|
|||
|
"5008 Coupe Petrol 4 8690 km 6.0 Automatic \n",
|
|||
|
"1225 Jeep Petrol 6.3 Turbo 0 km 8.0 Tiptronic \n",
|
|||
|
"8541 Universal Petrol 4 2531 km 8.0 Tiptronic \n",
|
|||
|
"16983 Goods wagon Diesel 1.7 99999 km 4.0 Manual \n",
|
|||
|
"\n",
|
|||
|
" Drive wheels Doors Wheel Airbags \n",
|
|||
|
"14839 4x4 04-May Left wheel 12 \n",
|
|||
|
"5008 Rear 02-Mar Left wheel 12 \n",
|
|||
|
"1225 4x4 04-May Left wheel 12 \n",
|
|||
|
"8541 4x4 04-May Left wheel 0 \n",
|
|||
|
"16983 Front 02-Mar Left wheel 0 \n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.info()\n",
|
|||
|
"\n",
|
|||
|
"print(df.describe().transpose())\n",
|
|||
|
"\n",
|
|||
|
"cleared_df = df.drop([\"Color\", \"Leather interior\"], axis=1)\n",
|
|||
|
"print(cleared_df.head())\n",
|
|||
|
"print(cleared_df.tail())\n",
|
|||
|
"\n",
|
|||
|
"sorted_df = cleared_df.sort_values(by=\"Price\")\n",
|
|||
|
"print(sorted_df.head())\n",
|
|||
|
"print(sorted_df.tail())"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с данными - работа с элементами"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 20,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"0 RX 450\n",
|
|||
|
"1 Equinox\n",
|
|||
|
"2 FIT\n",
|
|||
|
"3 Escape\n",
|
|||
|
"4 FIT\n",
|
|||
|
" ... \n",
|
|||
|
"19232 CLK 200\n",
|
|||
|
"19233 Sonata\n",
|
|||
|
"19234 Tucson\n",
|
|||
|
"19235 Captiva\n",
|
|||
|
"19236 Sonata\n",
|
|||
|
"Name: Model, Length: 19237, dtype: object\n",
|
|||
|
"ID 45809760\n",
|
|||
|
"Price 2901\n",
|
|||
|
"Levy 473\n",
|
|||
|
"Manufacturer CHEVROLET\n",
|
|||
|
"Model Cruze\n",
|
|||
|
"Prod. year 2014\n",
|
|||
|
"Category Sedan\n",
|
|||
|
"Leather interior Yes\n",
|
|||
|
"Fuel type Petrol\n",
|
|||
|
"Engine volume 1.4\n",
|
|||
|
"Mileage 80827 km\n",
|
|||
|
"Cylinders 4.0\n",
|
|||
|
"Gear box type Automatic\n",
|
|||
|
"Drive wheels Front\n",
|
|||
|
"Doors 04-May\n",
|
|||
|
"Wheel Left wheel\n",
|
|||
|
"Color Green\n",
|
|||
|
"Airbags 12\n",
|
|||
|
"Name: 100, dtype: object\n",
|
|||
|
"2901\n",
|
|||
|
" Model Price\n",
|
|||
|
"100 Cruze 2901\n",
|
|||
|
"101 911 706\n",
|
|||
|
"102 Fusion 314\n",
|
|||
|
"103 GX 460 15681\n",
|
|||
|
"104 Sprinter 26657\n",
|
|||
|
".. ... ...\n",
|
|||
|
"196 Sonata 706\n",
|
|||
|
"197 E 350 5802\n",
|
|||
|
"198 Camry 25716\n",
|
|||
|
"199 Orlando 14426\n",
|
|||
|
"200 RAV 4 10820\n",
|
|||
|
"\n",
|
|||
|
"[101 rows x 2 columns]\n",
|
|||
|
" ID Price Levy Manufacturer Model Prod. year Category \\\n",
|
|||
|
"0 45654403 13328 1399 LEXUS RX 450 2010 Jeep \n",
|
|||
|
"1 44731507 16621 1018 CHEVROLET Equinox 2011 Jeep \n",
|
|||
|
"2 45774419 8467 - HONDA FIT 2006 Hatchback \n",
|
|||
|
"\n",
|
|||
|
" Leather interior Fuel type Engine volume Mileage Cylinders \\\n",
|
|||
|
"0 Yes Hybrid 3.5 186005 km 6.0 \n",
|
|||
|
"1 No Petrol 3 192000 km 6.0 \n",
|
|||
|
"2 No Petrol 1.3 200000 km 4.0 \n",
|
|||
|
"\n",
|
|||
|
" Gear box type Drive wheels Doors Wheel Color Airbags \n",
|
|||
|
"0 Automatic 4x4 04-May Left wheel Silver 12 \n",
|
|||
|
"1 Tiptronic 4x4 04-May Left wheel Black 8 \n",
|
|||
|
"2 Variator Front 04-May Right-hand drive Black 2 \n",
|
|||
|
"ID 45654403\n",
|
|||
|
"Price 13328\n",
|
|||
|
"Levy 1399\n",
|
|||
|
"Manufacturer LEXUS\n",
|
|||
|
"Model RX 450\n",
|
|||
|
"Prod. year 2010\n",
|
|||
|
"Category Jeep\n",
|
|||
|
"Leather interior Yes\n",
|
|||
|
"Fuel type Hybrid\n",
|
|||
|
"Engine volume 3.5\n",
|
|||
|
"Mileage 186005 km\n",
|
|||
|
"Cylinders 6.0\n",
|
|||
|
"Gear box type Automatic\n",
|
|||
|
"Drive wheels 4x4\n",
|
|||
|
"Doors 04-May\n",
|
|||
|
"Wheel Left wheel\n",
|
|||
|
"Color Silver\n",
|
|||
|
"Airbags 12\n",
|
|||
|
"Name: 0, dtype: object\n",
|
|||
|
" ID Price\n",
|
|||
|
"3 45769185 3607\n",
|
|||
|
"4 45809263 11726\n",
|
|||
|
" ID Price\n",
|
|||
|
"3 45769185 3607\n",
|
|||
|
"4 45809263 11726\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"print(df[\"Model\"])\n",
|
|||
|
"\n",
|
|||
|
"print(df.loc[100])\n",
|
|||
|
"\n",
|
|||
|
"print(df.loc[100, \"Price\"])\n",
|
|||
|
"\n",
|
|||
|
"print(df.loc[100:200, [\"Model\", \"Price\"]])\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": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с данными - отбор и группировка"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 24,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"['LEXUS' 'CHEVROLET' 'HONDA' 'FORD' 'HYUNDAI' 'TOYOTA' 'MERCEDES-BENZ'\n",
|
|||
|
" 'OPEL' 'PORSCHE' 'BMW' 'JEEP' 'VOLKSWAGEN' 'AUDI' 'RENAULT' 'NISSAN'\n",
|
|||
|
" 'SUBARU' 'DAEWOO' 'KIA' 'MITSUBISHI' 'SSANGYONG' 'MAZDA' 'GMC' 'FIAT'\n",
|
|||
|
" 'INFINITI' 'ALFA ROMEO' 'SUZUKI' 'ACURA' 'LINCOLN' 'VAZ' 'GAZ' 'CITROEN'\n",
|
|||
|
" 'LAND ROVER' 'MINI' 'DODGE' 'CHRYSLER' 'JAGUAR' 'ISUZU' 'SKODA'\n",
|
|||
|
" 'DAIHATSU' 'BUICK' 'TESLA' 'CADILLAC' 'PEUGEOT' 'BENTLEY' 'VOLVO' 'სხვა'\n",
|
|||
|
" 'HAVAL' 'HUMMER' 'SCION' 'UAZ' 'MERCURY' 'ZAZ' 'ROVER' 'SEAT' 'LANCIA'\n",
|
|||
|
" 'MOSKVICH' 'MASERATI' 'FERRARI' 'SAAB' 'LAMBORGHINI' 'ROLLS-ROYCE'\n",
|
|||
|
" 'PONTIAC' 'SATURN' 'ASTON MARTIN' 'GREATWALL']\n",
|
|||
|
"LEXUS count = 982\n",
|
|||
|
"CHEVROLET count = 1069\n",
|
|||
|
"HONDA count = 977\n",
|
|||
|
"FORD count = 1111\n",
|
|||
|
"HYUNDAI count = 3769\n",
|
|||
|
"TOYOTA count = 3662\n",
|
|||
|
"MERCEDES-BENZ count = 2076\n",
|
|||
|
"OPEL count = 397\n",
|
|||
|
"PORSCHE count = 54\n",
|
|||
|
"BMW count = 1049\n",
|
|||
|
"JEEP count = 138\n",
|
|||
|
"VOLKSWAGEN count = 579\n",
|
|||
|
"AUDI count = 255\n",
|
|||
|
"RENAULT count = 37\n",
|
|||
|
"NISSAN count = 660\n",
|
|||
|
"SUBARU count = 275\n",
|
|||
|
"DAEWOO count = 91\n",
|
|||
|
"KIA count = 421\n",
|
|||
|
"MITSUBISHI count = 289\n",
|
|||
|
"SSANGYONG count = 441\n",
|
|||
|
"MAZDA count = 183\n",
|
|||
|
"GMC count = 15\n",
|
|||
|
"FIAT count = 78\n",
|
|||
|
"INFINITI count = 30\n",
|
|||
|
"ALFA ROMEO count = 4\n",
|
|||
|
"SUZUKI count = 76\n",
|
|||
|
"ACURA count = 15\n",
|
|||
|
"LINCOLN count = 15\n",
|
|||
|
"VAZ count = 48\n",
|
|||
|
"GAZ count = 12\n",
|
|||
|
"CITROEN count = 9\n",
|
|||
|
"LAND ROVER count = 49\n",
|
|||
|
"MINI count = 48\n",
|
|||
|
"DODGE count = 91\n",
|
|||
|
"CHRYSLER count = 26\n",
|
|||
|
"JAGUAR count = 42\n",
|
|||
|
"ISUZU count = 4\n",
|
|||
|
"SKODA count = 20\n",
|
|||
|
"DAIHATSU count = 13\n",
|
|||
|
"BUICK count = 16\n",
|
|||
|
"TESLA count = 1\n",
|
|||
|
"CADILLAC count = 14\n",
|
|||
|
"PEUGEOT count = 17\n",
|
|||
|
"BENTLEY count = 2\n",
|
|||
|
"VOLVO count = 19\n",
|
|||
|
"სხვა count = 2\n",
|
|||
|
"HAVAL count = 1\n",
|
|||
|
"HUMMER count = 5\n",
|
|||
|
"SCION count = 7\n",
|
|||
|
"UAZ count = 12\n",
|
|||
|
"MERCURY count = 4\n",
|
|||
|
"ZAZ count = 2\n",
|
|||
|
"ROVER count = 3\n",
|
|||
|
"SEAT count = 2\n",
|
|||
|
"LANCIA count = 1\n",
|
|||
|
"MOSKVICH count = 4\n",
|
|||
|
"MASERATI count = 4\n",
|
|||
|
"FERRARI count = 2\n",
|
|||
|
"SAAB count = 2\n",
|
|||
|
"LAMBORGHINI count = 1\n",
|
|||
|
"ROLLS-ROYCE count = 2\n",
|
|||
|
"PONTIAC count = 1\n",
|
|||
|
"SATURN count = 1\n",
|
|||
|
"ASTON MARTIN count = 1\n",
|
|||
|
"GREATWALL count = 1\n",
|
|||
|
"Total count = 19237\n",
|
|||
|
" Model Category Count\n",
|
|||
|
"0 09-Mar Sedan 2\n",
|
|||
|
"1 100 Jeep 2\n",
|
|||
|
"2 100 NX Sedan 1\n",
|
|||
|
"3 1000 Jeep 6\n",
|
|||
|
"4 1000 Sedan 11\n",
|
|||
|
"... ... ... ...\n",
|
|||
|
"2053 macan Jeep 1\n",
|
|||
|
"2054 macan Sedan 1\n",
|
|||
|
"2055 macan S Jeep 1\n",
|
|||
|
"2056 tC Coupe 3\n",
|
|||
|
"2057 xD Hatchback 3\n",
|
|||
|
"\n",
|
|||
|
"[2058 rows x 3 columns]\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"s_values = df[\"Manufacturer\"].unique()\n",
|
|||
|
"print(s_values)\n",
|
|||
|
"\n",
|
|||
|
"s_total = 0\n",
|
|||
|
"for s_value in s_values:\n",
|
|||
|
" count = df[df[\"Manufacturer\"] == s_value].shape[0]\n",
|
|||
|
" s_total += count\n",
|
|||
|
" print(s_value, \"count =\", count)\n",
|
|||
|
"print(\"Total count = \", s_total)\n",
|
|||
|
"\n",
|
|||
|
"print(df.groupby([\"Model\", \"Category\"]).size().reset_index(name=\"Count\")) # type: ignore"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Исходные данные"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 26,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
" Manufacturer Model Levy\n",
|
|||
|
"0 LEXUS RX 450 1399\n",
|
|||
|
"1 CHEVROLET Equinox 1018\n",
|
|||
|
"2 HONDA FIT -\n",
|
|||
|
"3 FORD Escape 862\n",
|
|||
|
"4 HONDA FIT 446\n",
|
|||
|
"... ... ... ...\n",
|
|||
|
"19232 MERCEDES-BENZ CLK 200 -\n",
|
|||
|
"19233 HYUNDAI Sonata 831\n",
|
|||
|
"19234 HYUNDAI Tucson 836\n",
|
|||
|
"19235 CHEVROLET Captiva 1288\n",
|
|||
|
"19236 HYUNDAI Sonata 753\n",
|
|||
|
"\n",
|
|||
|
"[19237 rows x 3 columns]\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"data = df[[\"Manufacturer\", \"Model\", \"Levy\"]].copy()\n",
|
|||
|
"data.dropna(subset=[\"Levy\"], inplace=True)\n",
|
|||
|
"print(data)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Сводка пяти чисел\n",
|
|||
|
"\n",
|
|||
|
"<img src=\"assets/quantile.png\" width=\"400\" style=\"background-color: white\">"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 45,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
" Prod. year \n",
|
|||
|
" min q1 q2 median q3 max\n",
|
|||
|
"Manufacturer \n",
|
|||
|
"ACURA 2001 2010.00 2012.0 2012.0 2014.00 2015\n",
|
|||
|
"ALFA ROMEO 2001 2001.00 2003.0 2003.0 2007.00 2013\n",
|
|||
|
"ASTON MARTIN 2007 2007.00 2007.0 2007.0 2007.00 2007\n",
|
|||
|
"AUDI 1995 2010.00 2013.0 2013.0 2014.00 2018\n",
|
|||
|
"BENTLEY 2012 2013.00 2014.0 2014.0 2015.00 2016\n",
|
|||
|
"... ... ... ... ... ... ...\n",
|
|||
|
"VAZ 1974 1986.00 1995.5 1995.5 2004.25 2018\n",
|
|||
|
"VOLKSWAGEN 1980 2003.00 2012.0 2012.0 2014.00 2019\n",
|
|||
|
"VOLVO 1993 2000.50 2006.0 2006.0 2010.50 2014\n",
|
|||
|
"ZAZ 1989 1989.25 1989.5 1989.5 1989.75 1990\n",
|
|||
|
"სხვა 2005 2005.50 2006.0 2006.0 2006.50 2007\n",
|
|||
|
"\n",
|
|||
|
"[65 rows x 6 columns]\n",
|
|||
|
" Prod. year \n",
|
|||
|
" low_iqr iqr high_iqr\n",
|
|||
|
"Manufacturer \n",
|
|||
|
"ACURA 2004.000 4.00 2020.000\n",
|
|||
|
"ALFA ROMEO 1992.000 6.00 2016.000\n",
|
|||
|
"ASTON MARTIN 2007.000 0.00 2007.000\n",
|
|||
|
"AUDI 2004.000 4.00 2020.000\n",
|
|||
|
"BENTLEY 2010.000 2.00 2018.000\n",
|
|||
|
"... ... ... ...\n",
|
|||
|
"VAZ 1958.625 18.25 2031.625\n",
|
|||
|
"VOLKSWAGEN 1986.500 11.00 2030.500\n",
|
|||
|
"VOLVO 1985.500 10.00 2025.500\n",
|
|||
|
"ZAZ 1988.500 0.50 1990.500\n",
|
|||
|
"სხვა 2004.000 1.00 2008.000\n",
|
|||
|
"\n",
|
|||
|
"[65 rows x 3 columns]\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Axes: title={'center': 'Prod. year'}, xlabel='Manufacturer'>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 45,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlYAAAHOCAYAAABaeEesAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAADW8UlEQVR4nOydd1wUx/vHPwcHCEixUESkROwSa8QSQaKiFIUgS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QXjxo0DIQQlJSXs35gxY1BeXo6///4bQN257NChA4KCgtj6TExMMHfu3GbZtGDBApHvixYtYusHAAsLC/j7++PIkSPsTEZNTQ1++ukndhlSVoKDgxEfHw+BQIBjx45BX18f77//vsSyxsbG7Ofq6mqUlpbCxcUFlpaWbBvUZ+7cuSLLr8OHD0dNTQ3u3bsns33SkNWmX375BX369JF4bA2XiBXBtGnTRGzLysrC3bt3ERwcjNLSUrYP8fl8jBw5EmlpaWI6rE8++UThdlEoANVYUbSYQYMGYdSoURg1ahQ+/vhjnDx5Ej179mQHOUCdRsTOzg5mZmYi2zJLa/UfQoaGhvjhhx+Qn5+Ply9fYt++fRIfCnp6eiKDIwDo2rUrADTqIqG4uBgVFRXo1q2bWF6PHj1QW1uLBw8eyH7w/w9jv4uLi1iepDQAcHZ2llhHY7YxD6iWIMnlQNeuXVFRUYHi4mIUFxejrKwM3377LaysrET+ZsyYAQAoKipi7XRxcRE7J5L
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"def q1(x):\n",
|
|||
|
" return x.quantile(0.25)\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"# median = quantile(0.5)\n",
|
|||
|
"def q2(x):\n",
|
|||
|
" return x.quantile(0.5)\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"def q3(x):\n",
|
|||
|
" return x.quantile(0.75)\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"def iqr(x):\n",
|
|||
|
" return q3(x) - q1(x)\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"def low_iqr(x):\n",
|
|||
|
" return max(0, q1(x) - 1.5 * iqr(x))\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"def high_iqr(x):\n",
|
|||
|
" return q3(x) + 1.5 * iqr(x)\n",
|
|||
|
"\n",
|
|||
|
"quantiles = df[[\"Manufacturer\", \"Prod. year\"]].groupby([\"Manufacturer\"]).aggregate([\"min\", q1, q2, \"median\", q3, \"max\"])\n",
|
|||
|
"print(quantiles)\n",
|
|||
|
"\n",
|
|||
|
"iqrs = (\n",
|
|||
|
" df[[\"Manufacturer\", \"Prod. year\"]].groupby([\"Manufacturer\"]).aggregate([low_iqr, iqr, high_iqr])\n",
|
|||
|
")\n",
|
|||
|
"print(iqrs)\n",
|
|||
|
"\n",
|
|||
|
"df.boxplot(column=\"Prod. year\", by=\"Manufacturer\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Гистограмма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 52,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Axes: ylabel='Frequency'>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 52,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAGdCAYAAADzOWwgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAyz0lEQVR4nO3deXgUZdr+/bOzkgCdEMgqYRNEEARBfxhlEWESFlGW51FZBCWKCzhIQCCjw6IzBnBAcEDRGSDgMiAz4gIPYCQIKhGFAVnEsGpkSAKCSSBIEpJ6//BNjW2ChqY73Ul9P8fRx2FX3am+Lqohp3ffVW0zDMMQAACAhfl4ugAAAABPIxABAADLIxABAADLIxABAADLIxABA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j5iY2M9XRIAAHAjrwhE48aN09q1a7V582Y1btzY3B4VFaXi4mLl5eU5jM/NzTW/WyoqKqrCVWflz39rjN1urzA7JEnJycnKz883H999990V9wgAALyXRwORYRgaN26c1qxZo/T0dDVv3txhf+fOneXv769NmzaZ2zIzM5WVlaW4uDhJUlxcnPbu3evwxappaWmy2+1q27atOebnxygfU36MXwoMDJTdbnd4AACA2suja4jGjh2rN998U++++67q169vrvkJCQlRUFCQQkJClJiYqKSkJIWFhclut+vxxx9XXFycbr75ZklSfHy82rZtq/vuu09z5sxRTk6Onn76aY0dO1aBgYGSpEceeUQLFy7U5Mm
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.plot.hist(column=[\"Prod. year\"], bins=80)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Точечная диаграмма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 58,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Axes: xlabel='Fuel type', ylabel='Category'>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 58,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAooAAAGwCAYAAAAufUTaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABrUUlEQVR4nO3dd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9lZ33ycXkqRUEVz93lGofVJz17xekUiEsUjiu9xcnKS/V2tWjUAkCVweWWPHz8GAKSlpeHBgweyJDKPu7s74uPjFV6nn58fFixYAHd3d8yePRuXLl0qtL2urq4sSQSAGjVqyGJ69eoVEhMT4evrC6lUKlsWLFiAxMSCT10GBAQgNTVVtty/f1/h+El5bD+yo7avWvCRZqLCWJroFlpvZcokkYjEMVF8j6bmvxd0SyQS0bLc3FyF+1NTeze8wnune7Kzs+XafP3117h9+zYGDRqEy5cvo2nTplizZo1CMebFlNd/evq7I04//fQT4uLiZMuVK1dw6tSpAvvU0tKCgYGB3EKl789v2hRaz9nPVFw25lK0tjOH+v9v1/KoSyRobWfOo4lEVCAmisVkYGCAmjVrIiYmRq48JiYGjo6OAABzc3MAkJtsEhcXl68vCwsLjBo1Crt378bkyZPx008/FSumatWqoWbNmrh9+zZsbW3lFmtr62L1SaVrvGedIpUTKWpNf2e425rJlbnbmmFNf2cVRURE5UG
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.plot.scatter(x=\"Fuel type\", y=\"Category\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Столбчатая диаграмма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 62,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<matplotlib.legend.Legend at 0x173840b6240>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 62,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image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dJibmxf5/f2sMp1CiouLw8qVK1G7dm3s3bsXo0ePxtixY7Fu3ToAQFJSEoCnV6I8y9bWVtqXlJQEGxsbtf06OjqwsrJS61PUYzz7HM+bM2cOzM3Npe3ZK2qIiIioYilTgMnPz0fTpk0xe/ZsNGnSBCNHjsSIESMKjWuQw9SpU5GWliZtzw5IJSIiooqlTAGmSpUqha5KcXFxQUJCAgBIk5E9OwV9we2CfXZ2dmrzhABPTyGlpKSo9SnqMZ59jufp6+vDzMxMbSMiIqKKqUwBplWrVtKU7wWuXLmCmjVrAgAcHR1hZ2eHsLAwaX96ejqOHTsGd3d3AIC7uztSU1MRExMj9Tlw4ADy8/Ol2Vvd3d1x6NAhtTlMQkNDUbdu3SLHvxAREdHbpUwBJiAgAEePHsXs2bNx7do1bNq0CT/++CN8fX0BPJ3EbPz48fj666/x559/4uzZsxg0aBCqVq2Knj17Anh6xOaDDz7AiBEjcPz4cURGRsLPzw/9+vVD1apVAQADBgyAnp4efHx8cP78efzyyy9YsmQJJkyY8HpfPRERESlSmdZCeuedd7Bjxw5MnToVM2fOhKOjIxYvXgxvb2+pz+TJk/Ho0SOMHDkSqampaN26Nfbs2aN2ZcbGjRvh5+eHjh07QktLC3369MHSpUul/ebm5ti3bx98fX3RrFkzVKpUCYGBgWpzxRAREdHbq0yXUStJSZdh8ZJXet34mSKiQngZ9Ut5I5dRExEREWkCBhii/0+
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"plot = df.groupby([\"Category\", \"Gear box type\"]).size().unstack().plot.bar(color=[\"pink\", \"green\"])\n",
|
|||
|
"plot.legend([\"Automatic\",\"Not automatic\"])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Временные ряды"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 78,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|||
|
"RangeIndex: 19237 entries, 0 to 19236\n",
|
|||
|
"Data columns (total 4 columns):\n",
|
|||
|
" # Column Non-Null Count Dtype \n",
|
|||
|
"--- ------ -------------- ----- \n",
|
|||
|
" 0 Manufacturer 19237 non-null object \n",
|
|||
|
" 1 Price 19237 non-null int64 \n",
|
|||
|
" 2 Prod. year 19237 non-null int64 \n",
|
|||
|
" 3 date 19237 non-null datetime64[ns]\n",
|
|||
|
"dtypes: datetime64[ns](1), int64(2), object(1)\n",
|
|||
|
"memory usage: 601.3+ KB\n",
|
|||
|
" Manufacturer Price Prod. year date\n",
|
|||
|
"0 LEXUS 13328 2010 2010-01-01\n",
|
|||
|
"1 CHEVROLET 16621 2011 2011-01-01\n",
|
|||
|
"2 HONDA 8467 2006 2006-01-01\n",
|
|||
|
"3 FORD 3607 2011 2011-01-01\n",
|
|||
|
"4 HONDA 11726 2014 2014-01-01\n",
|
|||
|
"... ... ... ... ...\n",
|
|||
|
"19232 MERCEDES-BENZ 8467 1999 1999-01-01\n",
|
|||
|
"19233 HYUNDAI 15681 2011 2011-01-01\n",
|
|||
|
"19234 HYUNDAI 26108 2010 2010-01-01\n",
|
|||
|
"19235 CHEVROLET 5331 2007 2007-01-01\n",
|
|||
|
"19236 HYUNDAI 470 2012 2012-01-01\n",
|
|||
|
"\n",
|
|||
|
"[19237 rows x 4 columns]\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"name": "stderr",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n",
|
|||
|
"Locator attempting to generate 32544 ticks ([-12802.0, ..., 19741.0]), which exceeds Locator.MAXTICKS (1000).\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiMAAAGqCAYAAADZfUQ8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA+zUlEQVR4nO3de3iU9Z3//9c9k2RyPpIjBAhBEOQUKaeAIlss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MwtiX7E4fDodbWVlVVVSk+Pt7V+dcTboURh8OhBx54QK+99pq2b9+urKwstz+wu7tbhw4d0q233ur2tQAA/7L4snUjklSwv8zvw4gk16YKZyCB5+Lj44e9ScWtMLJ27Vq99NJL2rx5s2JiYlRRUSFJiouLczXfWbNmjcaOHav8/HxJ0mOPPaaFCxdq8uTJqq+v1xNPPKEzZ87ovvvuG9bAAQDmGxsfoawxUSqp6Snx8EFJrcobLio9zr87+RqGofT0dKWkpKiz0/+nlvxVaGjosJ6IOLkVRp555hlJ0k033dTn9eeff1733HOPJKm0tFQWy6WlKBcuXNDXv/51VVRUKCEhQXPnzlVhYaGmT58+vJEDAPxCbnaSK4w4HD2dfO9fGhjN86xWq1d+mWJ4KAcPABiWNw+V69t/2Of687T0WP31wRtMHBH8hU/KwQMA8FmLJiXp8vWfR8sbdaKyybwBIeAQRgAAw5IQFabrMvr+r17Kw8MdhBEAwLAtzu7ZVRMV1rP
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from datetime import datetime\n",
|
|||
|
"import matplotlib.dates as md\n",
|
|||
|
"\n",
|
|||
|
"dt = pd.read_csv(\"../data/car_price_prediction.csv\")\n",
|
|||
|
"ts = dt[[\"Manufacturer\",\"Price\",\"Prod. year\"]].copy()\n",
|
|||
|
"tf = ts[\"Manufacturer\"].unique()\n",
|
|||
|
"ts[\"date\"] = ts[\"Prod. year\"].astype(str)\n",
|
|||
|
"ts[\"date\"] = ts.apply(lambda row: datetime.strptime(row[\"date\"], \"%Y\"), axis=1)\n",
|
|||
|
"ts.info()\n",
|
|||
|
"\n",
|
|||
|
"print(ts)\n",
|
|||
|
"\n",
|
|||
|
"plot = ts.plot.line(x=\"date\", y=\"Price\")\n",
|
|||
|
"plot.xaxis.set_major_locator(md.DayLocator(interval=1))\n",
|
|||
|
"plot.xaxis.set_major_formatter(md.DateFormatter(\"%Y\"))\n",
|
|||
|
"plot.tick_params(axis=\"x\", labelrotation=90)"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"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.6"
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 2
|
|||
|
}
|