{ "cells": [ { "cell_type": "markdown", "id": "51d5eebd", "metadata": {}, "source": [ "### Instalacja i import bibliotek" ] }, { "cell_type": "code", "execution_count": 74, "id": "300962ca", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: kaggle in c:\\users\\krzys\\anaconda3\\lib\\site-packages (1.6.6)\n", "Requirement already satisfied: bleach in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from kaggle) (6.1.0)\n", "Requirement already satisfied: python-dateutil in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from kaggle) (2.9.0.post0)\n", "Requirement already satisfied: six>=1.10 in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from kaggle) (1.16.0)\n", "Requirement already satisfied: requests in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from kaggle) (2.31.0)\n", "Requirement already satisfied: certifi in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from kaggle) (2024.2.2)\n", "Requirement already satisfied: tqdm in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from kaggle) (4.66.2)\n", "Requirement already satisfied: python-slugify in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from kaggle) (8.0.4)\n", "Requirement already satisfied: urllib3 in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from kaggle) (2.2.1)\n", "Requirement already satisfied: webencodings in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from bleach->kaggle) (0.5.1)\n", "Requirement already satisfied: text-unidecode>=1.3 in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from python-slugify->kaggle) (1.3)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from requests->kaggle) (3.3.2)\n", "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from requests->kaggle) (3.6)\n", "Requirement already satisfied: colorama in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from tqdm->kaggle) (0.4.6)\n", "Requirement already satisfied: pandas in c:\\users\\krzys\\anaconda3\\lib\\site-packages (1.4.2)\n", "Requirement already satisfied: pytz>=2020.1 in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from pandas) (2021.3)\n", "Requirement already satisfied: numpy>=1.18.5 in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from pandas) (1.21.5)\n", "Requirement already satisfied: python-dateutil>=2.8.1 in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from pandas) (2.9.0.post0)\n", "Requirement already satisfied: six>=1.5 in c:\\users\\krzys\\anaconda3\\lib\\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)\n" ] } ], "source": [ "!pip install kaggle\n", "!pip install pandas" ] }, { "cell_type": "code", "execution_count": 75, "id": "ace0fd9d", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.preprocessing import MinMaxScaler" ] }, { "cell_type": "markdown", "id": "8063f07b", "metadata": {}, "source": [ "### Pobranie zbioru danych" ] }, { "cell_type": "code", "execution_count": 76, "id": "13978bf5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "vehicle-sales-data.zip: Skipping, found more recently modified local copy (use --force to force download)\n" ] } ], "source": [ "!kaggle datasets download -d syedanwarafridi/vehicle-sales-data" ] }, { "cell_type": "code", "execution_count": 77, "id": "079faa4e", "metadata": {}, "outputs": [], "source": [ "#conda install git pip" ] }, { "cell_type": "code", "execution_count": 78, "id": "de0ab590", "metadata": {}, "outputs": [], "source": [ "#!pip install unzip" ] }, { "cell_type": "code", "execution_count": 79, "id": "265ecdca", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Archive: vehicle-sales-data.zip\n", " inflating: car_prices.csv \n" ] } ], "source": [ "!unzip -o vehicle-sales-data.zip" ] }, { "cell_type": "markdown", "id": "2bf18b9a", "metadata": {}, "source": [ "### Opis i czyszczenie danych danych" ] }, { "cell_type": "code", "execution_count": 80, "id": "145d6d72", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
yearmakemodeltrimbodytransmissionvinstateconditionodometercolorinteriorsellermmrsellingpricesaledate
02015KiaSorentoLXSUVautomatic5xyktca69fg566472ca5.016639.0whiteblackkia motors america inc20500.021500.0Tue Dec 16 2014 12:30:00 GMT-0800 (PST)
12015KiaSorentoLXSUVautomatic5xyktca69fg561319ca5.09393.0whitebeigekia motors america inc20800.021500.0Tue Dec 16 2014 12:30:00 GMT-0800 (PST)
22014BMW3 Series328i SULEVSedanautomaticwba3c1c51ek116351ca45.01331.0grayblackfinancial services remarketing (lease)31900.030000.0Thu Jan 15 2015 04:30:00 GMT-0800 (PST)
32015VolvoS60T5Sedanautomaticyv1612tb4f1310987ca41.014282.0whiteblackvolvo na rep/world omni27500.027750.0Thu Jan 29 2015 04:30:00 GMT-0800 (PST)
42014BMW6 Series Gran Coupe650iSedanautomaticwba6b2c57ed129731ca43.02641.0grayblackfinancial services remarketing (lease)66000.067000.0Thu Dec 18 2014 12:30:00 GMT-0800 (PST)
\n", "
" ], "text/plain": [ " year make model trim body transmission \\\n", "0 2015 Kia Sorento LX SUV automatic \n", "1 2015 Kia Sorento LX SUV automatic \n", "2 2014 BMW 3 Series 328i SULEV Sedan automatic \n", "3 2015 Volvo S60 T5 Sedan automatic \n", "4 2014 BMW 6 Series Gran Coupe 650i Sedan automatic \n", "\n", " vin state condition odometer color interior \\\n", "0 5xyktca69fg566472 ca 5.0 16639.0 white black \n", "1 5xyktca69fg561319 ca 5.0 9393.0 white beige \n", "2 wba3c1c51ek116351 ca 45.0 1331.0 gray black \n", "3 yv1612tb4f1310987 ca 41.0 14282.0 white black \n", "4 wba6b2c57ed129731 ca 43.0 2641.0 gray black \n", "\n", " seller mmr sellingprice \\\n", "0 kia motors america inc 20500.0 21500.0 \n", "1 kia motors america inc 20800.0 21500.0 \n", "2 financial services remarketing (lease) 31900.0 30000.0 \n", "3 volvo na rep/world omni 27500.0 27750.0 \n", "4 financial services remarketing (lease) 66000.0 67000.0 \n", "\n", " saledate \n", "0 Tue Dec 16 2014 12:30:00 GMT-0800 (PST) \n", "1 Tue Dec 16 2014 12:30:00 GMT-0800 (PST) \n", "2 Thu Jan 15 2015 04:30:00 GMT-0800 (PST) \n", "3 Thu Jan 29 2015 04:30:00 GMT-0800 (PST) \n", "4 Thu Dec 18 2014 12:30:00 GMT-0800 (PST) " ] }, "execution_count": 80, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = pd.read_csv('car_prices.csv')\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 81, "id": "5fb29c05", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(558837, 16)" ] }, "execution_count": 81, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.shape" ] }, { "cell_type": "code", "execution_count": 82, "id": "89130732", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 558837 entries, 0 to 558836\n", "Data columns (total 16 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 year 558837 non-null int64 \n", " 1 make 548536 non-null object \n", " 2 model 548438 non-null object \n", " 3 trim 548186 non-null object \n", " 4 body 545642 non-null object \n", " 5 transmission 493485 non-null object \n", " 6 vin 558833 non-null object \n", " 7 state 558837 non-null object \n", " 8 condition 547017 non-null float64\n", " 9 odometer 558743 non-null float64\n", " 10 color 558088 non-null object \n", " 11 interior 558088 non-null object \n", " 12 seller 558837 non-null object \n", " 13 mmr 558799 non-null float64\n", " 14 sellingprice 558825 non-null float64\n", " 15 saledate 558825 non-null object \n", "dtypes: float64(4), int64(1), object(11)\n", "memory usage: 68.2+ MB\n" ] } ], "source": [ "df.info()" ] }, { "cell_type": "code", "execution_count": 83, "id": "242cd7f0", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
yearmakemodeltrimbodytransmissionvinstateconditionodometercolorinteriorsellermmrsellingpricesaledate
count558837.000000548536548438548186545642493485558833558837547017.000000558743.000000558088558088558837558799.000000558825.000000558825
uniqueNaN96973196387455029764NaNNaN461714263NaNNaN3766
topNaNFordAltimaBaseSedanautomaticautomaticflNaNNaNblackblacknissan-infiniti ltNaNNaNTue Feb 10 2015 01:30:00 GMT-0800 (PST)
freqNaN9355419349558171994374759152282945NaNNaN11097024432919693NaNNaN5334
mean2010.038927NaNNaNNaNNaNNaNNaNNaN30.67236568320.017767NaNNaNNaN13769.37749513611.358810NaN
std3.966864NaNNaNNaNNaNNaNNaNNaN13.40283253398.542821NaNNaNNaN9679.9671749749.501628NaN
min1982.000000NaNNaNNaNNaNNaNNaNNaN1.0000001.000000NaNNaNNaN25.0000001.000000NaN
25%2007.000000NaNNaNNaNNaNNaNNaNNaN23.00000028371.000000NaNNaNNaN7100.0000006900.000000NaN
50%2012.000000NaNNaNNaNNaNNaNNaNNaN35.00000052254.000000NaNNaNNaN12250.00000012100.000000NaN
75%2013.000000NaNNaNNaNNaNNaNNaNNaN42.00000099109.000000NaNNaNNaN18300.00000018200.000000NaN
max2015.000000NaNNaNNaNNaNNaNNaNNaN49.000000999999.000000NaNNaNNaN182000.000000230000.000000NaN
\n", "
" ], "text/plain": [ " year make model trim body transmission vin \\\n", "count 558837.000000 548536 548438 548186 545642 493485 558833 \n", "unique NaN 96 973 1963 87 4 550297 \n", "top NaN Ford Altima Base Sedan automatic automatic \n", "freq NaN 93554 19349 55817 199437 475915 22 \n", "mean 2010.038927 NaN NaN NaN NaN NaN NaN \n", "std 3.966864 NaN NaN NaN NaN NaN NaN \n", "min 1982.000000 NaN NaN NaN NaN NaN NaN \n", "25% 2007.000000 NaN NaN NaN NaN NaN NaN \n", "50% 2012.000000 NaN NaN NaN NaN NaN NaN \n", "75% 2013.000000 NaN NaN NaN NaN NaN NaN \n", "max 2015.000000 NaN NaN NaN NaN NaN NaN \n", "\n", " state condition odometer color interior \\\n", "count 558837 547017.000000 558743.000000 558088 558088 \n", "unique 64 NaN NaN 46 17 \n", "top fl NaN NaN black black \n", "freq 82945 NaN NaN 110970 244329 \n", "mean NaN 30.672365 68320.017767 NaN NaN \n", "std NaN 13.402832 53398.542821 NaN NaN \n", "min NaN 1.000000 1.000000 NaN NaN \n", "25% NaN 23.000000 28371.000000 NaN NaN \n", "50% NaN 35.000000 52254.000000 NaN NaN \n", "75% NaN 42.000000 99109.000000 NaN NaN \n", "max NaN 49.000000 999999.000000 NaN NaN \n", "\n", " seller mmr sellingprice \\\n", "count 558837 558799.000000 558825.000000 \n", "unique 14263 NaN NaN \n", "top nissan-infiniti lt NaN NaN \n", "freq 19693 NaN NaN \n", "mean NaN 13769.377495 13611.358810 \n", "std NaN 9679.967174 9749.501628 \n", "min NaN 25.000000 1.000000 \n", "25% NaN 7100.000000 6900.000000 \n", "50% NaN 12250.000000 12100.000000 \n", "75% NaN 18300.000000 18200.000000 \n", "max NaN 182000.000000 230000.000000 \n", "\n", " saledate \n", "count 558825 \n", "unique 3766 \n", "top Tue Feb 10 2015 01:30:00 GMT-0800 (PST) \n", "freq 5334 \n", "mean NaN \n", "std NaN \n", "min NaN \n", "25% NaN \n", "50% NaN \n", "75% NaN \n", "max NaN " ] }, "execution_count": 83, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.describe(include='all')" ] }, { "cell_type": "code", "execution_count": 84, "id": "75742f81", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(472325, 16)" ] }, "execution_count": 84, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = df.dropna()\n", "df.shape" ] }, { "cell_type": "code", "execution_count": 85, "id": "93d5b418", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "year 0\n", "make 0\n", "model 0\n", "trim 0\n", "body 0\n", "transmission 0\n", "vin 0\n", "state 0\n", "condition 0\n", "odometer 0\n", "color 0\n", "interior 0\n", "seller 0\n", "mmr 0\n", "sellingprice 0\n", "saledate 0\n", "dtype: int64" ] }, "execution_count": 85, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.isna().sum()" ] }, { "cell_type": "code", "execution_count": 86, "id": "b039be76", "metadata": {}, "outputs": [], "source": [ "df['body'] = df['body'].replace({'sedan': 'Sedan'})\n", "df['body'] = df['body'].replace({'Suv': 'SUV'})\n", "df['body'] = df['body'].replace({'suv': 'SUV'})" ] }, { "cell_type": "code", "execution_count": 87, "id": "92787fae", "metadata": {}, "outputs": [], "source": [ "numeric_columns = df.select_dtypes(include=['int', 'float']).columns\n", "scaler = MinMaxScaler(feature_range=(0, 1))\n", "\n", "df_scaled = df.copy()\n", "df_scaled[numeric_columns] = scaler.fit_transform(df[numeric_columns])" ] }, { "cell_type": "code", "execution_count": 88, "id": "147f68ca", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
yearmakemodeltrimbodytransmissionvinstateconditionodometercolorinteriorsellermmrsellingpricesaledate
01.00KiaSorentoLXSUVautomatic5xyktca69fg566472ca0.0833330.016638whiteblackkia motors america inc0.1125150.093474Tue Dec 16 2014 12:30:00 GMT-0800 (PST)
11.00KiaSorentoLXSUVautomatic5xyktca69fg561319ca0.0833330.009392whitebeigekia motors america inc0.1141640.093474Tue Dec 16 2014 12:30:00 GMT-0800 (PST)
20.96BMW3 Series328i SULEVSedanautomaticwba3c1c51ek116351ca0.9166670.001330grayblackfinancial services remarketing (lease)0.1751610.130431Thu Jan 15 2015 04:30:00 GMT-0800 (PST)
31.00VolvoS60T5Sedanautomaticyv1612tb4f1310987ca0.8333330.014281whiteblackvolvo na rep/world omni0.1509820.120648Thu Jan 29 2015 04:30:00 GMT-0800 (PST)
40.96BMW6 Series Gran Coupe650iSedanautomaticwba6b2c57ed129731ca0.8750000.002640grayblackfinancial services remarketing (lease)0.3625500.291301Thu Dec 18 2014 12:30:00 GMT-0800 (PST)
\n", "
" ], "text/plain": [ " year make model trim body transmission \\\n", "0 1.00 Kia Sorento LX SUV automatic \n", "1 1.00 Kia Sorento LX SUV automatic \n", "2 0.96 BMW 3 Series 328i SULEV Sedan automatic \n", "3 1.00 Volvo S60 T5 Sedan automatic \n", "4 0.96 BMW 6 Series Gran Coupe 650i Sedan automatic \n", "\n", " vin state condition odometer color interior \\\n", "0 5xyktca69fg566472 ca 0.083333 0.016638 white black \n", "1 5xyktca69fg561319 ca 0.083333 0.009392 white beige \n", "2 wba3c1c51ek116351 ca 0.916667 0.001330 gray black \n", "3 yv1612tb4f1310987 ca 0.833333 0.014281 white black \n", "4 wba6b2c57ed129731 ca 0.875000 0.002640 gray black \n", "\n", " seller mmr sellingprice \\\n", "0 kia motors america inc 0.112515 0.093474 \n", "1 kia motors america inc 0.114164 0.093474 \n", "2 financial services remarketing (lease) 0.175161 0.130431 \n", "3 volvo na rep/world omni 0.150982 0.120648 \n", "4 financial services remarketing (lease) 0.362550 0.291301 \n", "\n", " saledate \n", "0 Tue Dec 16 2014 12:30:00 GMT-0800 (PST) \n", "1 Tue Dec 16 2014 12:30:00 GMT-0800 (PST) \n", "2 Thu Jan 15 2015 04:30:00 GMT-0800 (PST) \n", "3 Thu Jan 29 2015 04:30:00 GMT-0800 (PST) \n", "4 Thu Dec 18 2014 12:30:00 GMT-0800 (PST) " ] }, "execution_count": 88, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_scaled.head()" ] }, { "cell_type": "markdown", "id": "3df15219", "metadata": {}, "source": [ "### PodziaƂ danych na podzbiory" ] }, { "cell_type": "code", "execution_count": 89, "id": "8589727c", "metadata": {}, "outputs": [], "source": [ "car_train, car_dev_test = train_test_split(df, random_state = 0, train_size = 0.8)\n", "car_dev, car_test = train_test_split(car_dev_test, random_state = 0, train_size = 0.5)" ] }, { "cell_type": "code", "execution_count": 90, "id": "728bfc11", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(377860, 16)\n", "(47232, 16)\n", "(47233, 16)\n" ] } ], "source": [ "print(car_train.shape)\n", "print(car_dev.shape)\n", "print(car_test.shape)" ] }, { "cell_type": "markdown", "id": "632d1ab8", "metadata": {}, "source": [ "### Statystyki zbioru" ] }, { "cell_type": "code", "execution_count": 91, "id": "edca0016", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Ford 81013\n", "Chevrolet 54150\n", "Nissan 44043\n", "Toyota 35313\n", "Dodge 27181\n", "Honda 24781\n", "Hyundai 18659\n", "BMW 17509\n", "Kia 15828\n", "Chrysler 15133\n", "Name: make, dtype: int64" ] }, "execution_count": 91, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df['make'].value_counts().head(10)" ] }, { "cell_type": "code", "execution_count": 92, "id": "429a052f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Sedan 211298\n", "SUV 120968\n", "Hatchback 19351\n", "Minivan 18305\n", "Coupe 13121\n", "Wagon 12023\n", "Crew Cab 11508\n", "Convertible 7725\n", "SuperCrew 6195\n", "G Sedan 5644\n", "Name: body, dtype: int64" ] }, "execution_count": 92, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df['body'].value_counts().head(10)" ] }, { "cell_type": "code", "execution_count": 93, "id": "4c247aca", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "automatic 455963\n", "manual 16362\n", "Name: transmission, dtype: int64" ] }, "execution_count": 93, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df['transmission'].value_counts()" ] }, { "cell_type": "code", "execution_count": null, "id": "ce3e9252", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.9.12" } }, "nbformat": 4, "nbformat_minor": 5 }