{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "authorship_tag": "ABX9TyPmt2lmbu+FwSqN/2ioK1mu" }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "id": "I6tnizR9KmGN" }, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n" ] }, { "cell_type": "code", "source": [ "car = pd.read_csv('https://raw.githubusercontent.com/rajtilakls2510/car_price_predictor/master/quikr_car.csv')\n", "car.head()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 206 }, "id": "_QB98RY-L_DI", "outputId": "85adff85-d29f-46d3-9b5c-c721a0dcc7f8" }, "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " name company year Price \\\n", "0 Hyundai Santro Xing XO eRLX Euro III Hyundai 2007 80,000 \n", "1 Mahindra Jeep CL550 MDI Mahindra 2006 4,25,000 \n", "2 Maruti Suzuki Alto 800 Vxi Maruti 2018 Ask For Price \n", "3 Hyundai Grand i10 Magna 1.2 Kappa VTVT Hyundai 2014 3,25,000 \n", "4 Ford EcoSport Titanium 1.5L TDCi Ford 2014 5,75,000 \n", "\n", " kms_driven fuel_type \n", "0 45,000 kms Petrol \n", "1 40 kms Diesel \n", "2 22,000 kms Petrol \n", "3 28,000 kms Petrol \n", "4 36,000 kms Diesel " ], "text/html": [ "\n", "
\n", " | name | \n", "company | \n", "year | \n", "Price | \n", "kms_driven | \n", "fuel_type | \n", "
---|---|---|---|---|---|---|
0 | \n", "Hyundai Santro Xing XO eRLX Euro III | \n", "Hyundai | \n", "2007 | \n", "80,000 | \n", "45,000 kms | \n", "Petrol | \n", "
1 | \n", "Mahindra Jeep CL550 MDI | \n", "Mahindra | \n", "2006 | \n", "4,25,000 | \n", "40 kms | \n", "Diesel | \n", "
2 | \n", "Maruti Suzuki Alto 800 Vxi | \n", "Maruti | \n", "2018 | \n", "Ask For Price | \n", "22,000 kms | \n", "Petrol | \n", "
3 | \n", "Hyundai Grand i10 Magna 1.2 Kappa VTVT | \n", "Hyundai | \n", "2014 | \n", "3,25,000 | \n", "28,000 kms | \n", "Petrol | \n", "
4 | \n", "Ford EcoSport Titanium 1.5L TDCi | \n", "Ford | \n", "2014 | \n", "5,75,000 | \n", "36,000 kms | \n", "Diesel | \n", "
\n", " | name | \n", "company | \n", "year | \n", "Price | \n", "kms_driven | \n", "fuel_type | \n", "
---|---|---|---|---|---|---|
0 | \n", "Hyundai Santro Xing | \n", "Hyundai | \n", "2007 | \n", "80000 | \n", "45000 | \n", "Petrol | \n", "
1 | \n", "Mahindra Jeep CL550 | \n", "Mahindra | \n", "2006 | \n", "425000 | \n", "40 | \n", "Diesel | \n", "
2 | \n", "Hyundai Grand i10 | \n", "Hyundai | \n", "2014 | \n", "325000 | \n", "28000 | \n", "Petrol | \n", "
3 | \n", "Ford EcoSport Titanium | \n", "Ford | \n", "2014 | \n", "575000 | \n", "36000 | \n", "Diesel | \n", "
4 | \n", "Ford Figo | \n", "Ford | \n", "2012 | \n", "175000 | \n", "41000 | \n", "Diesel | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
811 | \n", "Maruti Suzuki Ritz | \n", "Maruti | \n", "2011 | \n", "270000 | \n", "50000 | \n", "Petrol | \n", "
812 | \n", "Tata Indica V2 | \n", "Tata | \n", "2009 | \n", "110000 | \n", "30000 | \n", "Diesel | \n", "
813 | \n", "Toyota Corolla Altis | \n", "Toyota | \n", "2009 | \n", "300000 | \n", "132000 | \n", "Petrol | \n", "
814 | \n", "Tata Zest XM | \n", "Tata | \n", "2018 | \n", "260000 | \n", "27000 | \n", "Diesel | \n", "
815 | \n", "Mahindra Quanto C8 | \n", "Mahindra | \n", "2013 | \n", "390000 | \n", "40000 | \n", "Diesel | \n", "
816 rows × 6 columns
\n", "\n", " | year | \n", "Price | \n", "kms_driven | \n", "
---|---|---|---|
count | \n", "816.000000 | \n", "8.160000e+02 | \n", "816.000000 | \n", "
mean | \n", "2012.444853 | \n", "4.117176e+05 | \n", "46275.531863 | \n", "
std | \n", "4.002992 | \n", "4.751844e+05 | \n", "34297.428044 | \n", "
min | \n", "1995.000000 | \n", "3.000000e+04 | \n", "0.000000 | \n", "
25% | \n", "2010.000000 | \n", "1.750000e+05 | \n", "27000.000000 | \n", "
50% | \n", "2013.000000 | \n", "2.999990e+05 | \n", "41000.000000 | \n", "
75% | \n", "2015.000000 | \n", "4.912500e+05 | \n", "56818.500000 | \n", "
max | \n", "2019.000000 | \n", "8.500003e+06 | \n", "400000.000000 | \n", "
\n", " | name | \n", "company | \n", "year | \n", "kms_driven | \n", "fuel_type | \n", "
---|---|---|---|---|---|
0 | \n", "Hyundai Santro Xing | \n", "Hyundai | \n", "2007 | \n", "45000 | \n", "Petrol | \n", "
1 | \n", "Mahindra Jeep CL550 | \n", "Mahindra | \n", "2006 | \n", "40 | \n", "Diesel | \n", "
3 | \n", "Hyundai Grand i10 | \n", "Hyundai | \n", "2014 | \n", "28000 | \n", "Petrol | \n", "
4 | \n", "Ford EcoSport Titanium | \n", "Ford | \n", "2014 | \n", "36000 | \n", "Diesel | \n", "
6 | \n", "Ford Figo | \n", "Ford | \n", "2012 | \n", "41000 | \n", "Diesel | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
883 | \n", "Maruti Suzuki Ritz | \n", "Maruti | \n", "2011 | \n", "50000 | \n", "Petrol | \n", "
885 | \n", "Tata Indica V2 | \n", "Tata | \n", "2009 | \n", "30000 | \n", "Diesel | \n", "
886 | \n", "Toyota Corolla Altis | \n", "Toyota | \n", "2009 | \n", "132000 | \n", "Petrol | \n", "
888 | \n", "Tata Zest XM | \n", "Tata | \n", "2018 | \n", "27000 | \n", "Diesel | \n", "
889 | \n", "Mahindra Quanto C8 | \n", "Mahindra | \n", "2013 | \n", "40000 | \n", "Diesel | \n", "
815 rows × 5 columns
\n", "OneHotEncoder()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
OneHotEncoder()
Pipeline(steps=[('columntransformer',\n", " ColumnTransformer(remainder='passthrough',\n", " transformers=[('onehotencoder',\n", " OneHotEncoder(categories=[array(['Audi A3 Cabriolet', 'Audi A4 1.8', 'Audi A4 2.0', 'Audi A6 2.0',\n", " 'Audi A8', 'Audi Q3 2.0', 'Audi Q5 2.0', 'Audi Q7', 'BMW 3 Series',\n", " 'BMW 5 Series', 'BMW 7 Series', 'BMW X1', 'BMW X1 sDrive20d',\n", " 'BMW X1 xDrive20d', 'Chevrolet Beat', 'Chevrolet Beat...\n", " array(['Audi', 'BMW', 'Chevrolet', 'Datsun', 'Fiat', 'Force', 'Ford',\n", " 'Hindustan', 'Honda', 'Hyundai', 'Jaguar', 'Jeep', 'Land',\n", " 'Mahindra', 'Maruti', 'Mercedes', 'Mini', 'Mitsubishi', 'Nissan',\n", " 'Renault', 'Skoda', 'Tata', 'Toyota', 'Volkswagen', 'Volvo'],\n", " dtype=object),\n", " array(['Diesel', 'LPG', 'Petrol'], dtype=object)]),\n", " ['name', 'company',\n", " 'fuel_type'])])),\n", " ('linearregression', LinearRegression())])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('columntransformer',\n", " ColumnTransformer(remainder='passthrough',\n", " transformers=[('onehotencoder',\n", " OneHotEncoder(categories=[array(['Audi A3 Cabriolet', 'Audi A4 1.8', 'Audi A4 2.0', 'Audi A6 2.0',\n", " 'Audi A8', 'Audi Q3 2.0', 'Audi Q5 2.0', 'Audi Q7', 'BMW 3 Series',\n", " 'BMW 5 Series', 'BMW 7 Series', 'BMW X1', 'BMW X1 sDrive20d',\n", " 'BMW X1 xDrive20d', 'Chevrolet Beat', 'Chevrolet Beat...\n", " array(['Audi', 'BMW', 'Chevrolet', 'Datsun', 'Fiat', 'Force', 'Ford',\n", " 'Hindustan', 'Honda', 'Hyundai', 'Jaguar', 'Jeep', 'Land',\n", " 'Mahindra', 'Maruti', 'Mercedes', 'Mini', 'Mitsubishi', 'Nissan',\n", " 'Renault', 'Skoda', 'Tata', 'Toyota', 'Volkswagen', 'Volvo'],\n", " dtype=object),\n", " array(['Diesel', 'LPG', 'Petrol'], dtype=object)]),\n", " ['name', 'company',\n", " 'fuel_type'])])),\n", " ('linearregression', LinearRegression())])
ColumnTransformer(remainder='passthrough',\n", " transformers=[('onehotencoder',\n", " OneHotEncoder(categories=[array(['Audi A3 Cabriolet', 'Audi A4 1.8', 'Audi A4 2.0', 'Audi A6 2.0',\n", " 'Audi A8', 'Audi Q3 2.0', 'Audi Q5 2.0', 'Audi Q7', 'BMW 3 Series',\n", " 'BMW 5 Series', 'BMW 7 Series', 'BMW X1', 'BMW X1 sDrive20d',\n", " 'BMW X1 xDrive20d', 'Chevrolet Beat', 'Chevrolet Beat Diesel',\n", " 'Chevrolet Beat LS', 'Chevrolet B...\n", " 'Volkswagen Vento Konekt', 'Volvo S80 Summum'], dtype=object),\n", " array(['Audi', 'BMW', 'Chevrolet', 'Datsun', 'Fiat', 'Force', 'Ford',\n", " 'Hindustan', 'Honda', 'Hyundai', 'Jaguar', 'Jeep', 'Land',\n", " 'Mahindra', 'Maruti', 'Mercedes', 'Mini', 'Mitsubishi', 'Nissan',\n", " 'Renault', 'Skoda', 'Tata', 'Toyota', 'Volkswagen', 'Volvo'],\n", " dtype=object),\n", " array(['Diesel', 'LPG', 'Petrol'], dtype=object)]),\n", " ['name', 'company', 'fuel_type'])])
['name', 'company', 'fuel_type']
OneHotEncoder(categories=[array(['Audi A3 Cabriolet', 'Audi A4 1.8', 'Audi A4 2.0', 'Audi A6 2.0',\n", " 'Audi A8', 'Audi Q3 2.0', 'Audi Q5 2.0', 'Audi Q7', 'BMW 3 Series',\n", " 'BMW 5 Series', 'BMW 7 Series', 'BMW X1', 'BMW X1 sDrive20d',\n", " 'BMW X1 xDrive20d', 'Chevrolet Beat', 'Chevrolet Beat Diesel',\n", " 'Chevrolet Beat LS', 'Chevrolet Beat LT', 'Chevrolet Beat PS',\n", " 'Chevrolet Cruze LTZ', 'Chevrolet Enjoy', 'Chevrolet E...\n", " 'Volkswagen Vento Comfortline', 'Volkswagen Vento Highline',\n", " 'Volkswagen Vento Konekt', 'Volvo S80 Summum'], dtype=object),\n", " array(['Audi', 'BMW', 'Chevrolet', 'Datsun', 'Fiat', 'Force', 'Ford',\n", " 'Hindustan', 'Honda', 'Hyundai', 'Jaguar', 'Jeep', 'Land',\n", " 'Mahindra', 'Maruti', 'Mercedes', 'Mini', 'Mitsubishi', 'Nissan',\n", " 'Renault', 'Skoda', 'Tata', 'Toyota', 'Volkswagen', 'Volvo'],\n", " dtype=object),\n", " array(['Diesel', 'LPG', 'Petrol'], dtype=object)])
['year', 'kms_driven']
passthrough
LinearRegression()