Skip to content

Instantly share code, notes, and snippets.

@shahnawazm786
Last active October 12, 2019 06:45
Show Gist options
  • Save shahnawazm786/7688a3206631f4a5697d33cd95b04d66 to your computer and use it in GitHub Desktop.
Save shahnawazm786/7688a3206631f4a5697d33cd95b04d66 to your computer and use it in GitHub Desktop.
Car Sales
Manufacturer Model Sales_in_thousands __year_resale_value Vehicle_type Price_in_thousands Engine_size Horsepower Wheelbase Width Length Curb_weight Fuel_capacity Fuel_efficiency Latest_Launch Power_perf_factor
Acura Integra 16.919 16.36 Passenger 21.5 1.8 140 101.2 67.3 172.4 2.639 13.2 28 2/2/2012 58.28014952
Acura TL 39.384 19.875 Passenger 28.4 3.2 225 108.1 70.3 192.9 3.517 17.2 25 6/3/2011 91.37077766
Acura CL 14.114 18.225 Passenger 3.2 225 106.9 70.6 192 3.47 17.2 26 1/4/2012
Acura RL 8.588 29.725 Passenger 42 3.5 210 114.6 71.4 196.6 3.85 18 22 3/10/2011 91.38977933
Audi A4 20.397 22.255 Passenger 23.99 1.8 150 102.6 68.2 178 2.998 16.4 27 10/8/2011 62.7776392
Audi A6 18.78 23.555 Passenger 33.95 2.8 200 108.7 76.1 192 3.561 18.5 22 8/9/2011 84.56510502
Audi A8 1.38 39 Passenger 62 4.2 310 113 74 198.2 3.902 23.7 21 2/27/2012 134.6568582
BMW 323i 19.747 Passenger 26.99 2.5 170 107.3 68.4 176 3.179 16.6 26 6/28/2011 71.19120671
BMW 328i 9.231 28.675 Passenger 33.4 2.8 193 107.3 68.5 176 3.197 16.6 24 1/29/2012 81.87706856
BMW 528i 17.527 36.125 Passenger 38.9 2.8 193 111.4 70.9 188 3.472 18.5 25 4/4/2011 83.9987238
Buick Century 91.561 12.475 Passenger 21.975 3.1 175 109 72.7 194.6 3.368 17.5 25 11/2/2011 71.18145132
Buick Regal 39.35 13.74 Passenger 25.3 3.8 240 109 72.7 196.2 3.543 17.5 23 9/3/2011 95.63670253
Buick Park Avenue 27.851 20.19 Passenger 31.965 3.8 205 113.8 74.7 206.8 3.778 18.5 24 3/23/2012 85.82840825
Buick LeSabre 83.257 13.36 Passenger 27.885 3.8 205 112.2 73.5 200 3.591 17.5 25 7/23/2011 84.25452581
Cadillac DeVille 63.729 22.525 Passenger 39.895 4.6 275 115.3 74.5 207.2 3.978 18.5 22 2/23/2012 113.8545976
Cadillac Seville 15.943 27.1 Passenger 44.475 4.6 275 112.2 75 201 18.5 22 4/29/2011 115.6213578
Cadillac Eldorado 6.536 25.725 Passenger 39.665 4.6 275 108 75.5 200.6 3.843 19 22 11/27/2011 113.7658739
Cadillac Catera 11.185 18.225 Passenger 31.01 3 200 107.4 70.3 194.8 3.77 18 22 9/28/2011 83.48309358
Cadillac Escalade 14.785 Car 46.225 5.7 255 117.5 77 201.2 5.572 30 15 4/17/2012 109.5091165
Chevrolet Cavalier 145.519 9.25 Passenger 13.26 2.2 115 104.1 67.9 180.9 2.676 14.3 27 8/17/2011 46.36334747
Chevrolet Malibu 135.126 11.225 Passenger 16.535 3.1 170 107 69.4 190.4 3.051 15 25 3/19/2012 67.31446216
Chevrolet Lumina 24.629 10.31 Passenger 18.89 3.1 175 107.5 72.5 200.9 3.33 16.6 25 5/24/2011 69.9913956
Chevrolet Monte Carlo 42.593 11.525 Passenger 19.39 3.4 180 110.5 72.7 197.9 3.34 17 27 12/22/2011 72.03091719
Chevrolet Camaro 26.402 13.025 Passenger 24.34 3.8 200 101.1 74.1 193.2 3.5 16.8 25 10/23/2011 81.11854333
Chevrolet Corvette 17.947 36.225 Passenger 45.705 5.7 345 104.5 73.6 179.7 3.21 19.1 22 5/12/2012 141.14115
Chevrolet Prizm 32.299 9.125 Passenger 13.96 1.8 120 97.1 66.7 174.3 2.398 13.2 33 9/11/2011 48.2976361
Chevrolet Metro 21.855 5.16 Passenger 9.235 1 55 93.1 62.6 149.4 1.895 10.3 45 4/13/2012 23.27627233
Chevrolet Impala 107.995 Passenger 18.89 3.4 180 110.5 73 200 3.389 17 27 6/18/2011 71.83803944
Chrysler Sebring Coupe 7.854 12.36 Passenger 19.84 2.5 163 103.7 69.7 190.9 2.967 15.9 24 1/16/2012 65.95718396
Chrysler Sebring Conv. 32.775 14.18 Passenger 24.495 2.5 168 106 69.2 193 3.332 16 24 11/17/2011 69.52135505
Chrysler Concorde 31.148 13.725 Passenger 22.245 2.7 200 113 74.4 209.1 3.452 17 26 6/6/2012 80.02378204
Chrysler Cirrus 32.306 12.64 Passenger 16.48 2 132 108 71 186 2.911 16 27 10/6/2011 53.56619987
Chrysler LHS 13.462 17.325 Passenger 28.34 3.5 253 113 74.4 207.7 3.564 17 23 5/8/2012 101.3292807
Chrysler Town & Country 53.48 19.54 Car 7/13/2011
Chrysler 300M 30.696 Passenger 29.185 3.5 253 113 74.4 197.8 3.567 17 23 2/10/2012 101.6552441
Dodge Neon 76.034 7.75 Passenger 12.64 2 132 105 74.4 174.4 2.567 12.5 29 12/12/2011 52.08489875
Dodge Avenger 4.734 12.545 Passenger 19.045 2.5 163 103.7 69.1 190.2 2.879 15.9 24 7/1/2012 65.65050834
Dodge Stratus 71.186 10.185 Passenger 20.23 2.5 168 108 71 186 3.058 16 24 10/31/2011 67.87610784
Dodge Intrepid 88.028 12.275 Passenger 22.505 2.7 202 113 74.7 203.7 3.489 17 6/2/2012 80.83147017
Dodge Viper 0.916 58.47 Passenger 69.725 8 450 96.2 75.7 176.7 3.375 19 16 8/7/2011 188.144323
Dodge Ram Pickup 227.061 15.06 Car 19.46 5.2 230 138.7 79.3 224.2 4.47 26 17 3/6/2012 90.21170005
Dodge Ram Wagon 16.767 15.51 Car 21.315 3.9 175 109.6 78.8 192.6 4.245 32 15 1/6/2012 71.13529161
Dodge Ram Van 31.038 13.425 Car 18.575 3.9 175 127.2 78.8 208.5 4.298 32 16 7/26/2012 70.07832154
Dodge Dakota 111.313 11.26 Car 16.98 2.5 120 131 71.5 215 3.557 22 19 11/25/2011 49.64500177
Dodge Durango 101.323 Car 26.31 5.2 230 115.7 71.7 193.5 4.394 25 17 6/27/2012 92.85412522
Dodge Caravan 181.749 12.025 Car 19.565 2.4 150 113.3 76.8 186.3 3.533 20 24 9/1/2011 61.22700031
Ford Escort 70.227 7.425 Passenger 12.07 2 110 98.4 67 174.7 2.468 12.7 30 3/31/2012 44.08370946
Ford Mustang 113.369 12.76 Passenger 21.56 3.8 190 101.3 73.1 183.2 3.203 15.7 24 1/31/2012 76.50918456
Ford Contour 35.068 8.835 Passenger 17.035 2.5 170 106.5 69.1 184.6 2.769 15 25 8/20/2012 67.35101072
Ford Taurus 245.815 10.055 Passenger 17.885 3 155 108.5 73 197.6 3.368 16 24 12/20/2011 62.5037395
Ford Focus 175.67 Passenger 12.315 2 107 103 66.9 174.8 2.564 13.2 30 7/22/2012 43.11713201
Ford Crown Victoria 63.403 14.21 Passenger 22.195 4.6 200 114.7 78.2 212 3.908 19 21 9/26/2011 80.49953671
Ford Explorer 276.747 16.64 Car 31.93 4 210 111.6 70.2 190.7 3.876 21 19 4/25/2012 87.63549578
Ford Windstar 155.787 13.175 Car 21.41 3 150 120.7 76.6 200.9 3.761 26 21 2/25/2012 62.09504839
Ford Expedition 125.338 23.575 Car 36.135 4.6 240 119 78.7 204.6 4.808 26 16 9/14/2012 100.0248023
Ford Ranger 220.65 7.85 Car 12.05 2.5 119 117.5 69.4 200.7 3.086 20 23 1/14/2012 47.38953131
Ford F-Series 540.561 15.075 Car 26.935 4.6 220 138.5 79.1 224.5 4.241 25.1 18 8/16/2012 89.40193473
Honda Civic 199.685 9.85 Passenger 12.885 1.6 106 103.2 67.1 175.1 2.339 11.9 32 10/21/2011 42.87909734
Honda Accord 230.902 13.21 Passenger 15.35 2.3 135 106.9 70.3 188.8 2.932 17.1 27 5/20/2012 54.26954829
Honda CR-V 73.203 17.71 Car 20.55 2 146 103.2 68.9 177.6 3.219 15.3 24 3/21/2012 60.08796662
Honda Passport 12.855 17.525 Car 26.6 3.2 205 106.4 70.4 178.2 3.857 21.1 19 10/9/2012 83.6025008
Honda Odyssey 76.029 19.49 Car 26 3.5 210 118.1 75.6 201.2 4.288 20 23 2/8/2012 85.21769134
Hyundai Accent 41.184 5.86 Passenger 9.699 1.5 92 96.1 65.7 166.7 2.24 11.9 31 9/10/2012 36.67228358
Hyundai Elantra 66.692 7.825 Passenger 11.799 2 140 100.4 66.9 174 2.626 14.5 27 11/15/2011 54.59004516
Hyundai Sonata 29.45 8.91 Passenger 14.999 2.4 148 106.3 71.6 185.4 3.072 17.2 25 6/14/2012 58.758249
Infiniti I30 23.713 19.69 Passenger 29.465 3 227 108.3 70.2 193.7 3.342 18.5 25 4/15/2012 92.43688923
Jaguar S-Type 15.467 Passenger 42.8 3 240 114.5 71.6 191.3 3.65 18.4 21 11/3/2012 102.1789848
Jeep Wrangler 55.557 13.475 Car 14.46 2.5 120 93.4 66.7 152 3.045 19 17 3/4/2012 48.67289791
Jeep Cherokee 80.556 13.775 Car 21.62 4 190 101.4 69.4 167.5 3.194 20 20 10/5/2012 76.58443962
Jeep Grand Cherokee 157.04 18.81 Car 26.895 4 195 105.9 72.3 181.5 3.88 20.5 19 12/10/2011 80.38777912
Lexus ES300 24.072 26.975 Passenger 31.505 3 210 105.1 70.5 190.2 3.373 18.5 23 7/9/2012 87.21100104
Lexus GS300 12.698 32.075 Passenger 37.805 3 225 110.2 70.9 189.2 3.638 19.8 23 5/10/2012 94.9466984
Lexus GS400 3.334 Passenger 46.305 4 300 110.2 70.9 189.2 3.693 19.8 21 11/28/2012 125.0133574
Lexus LS400 6.375 40.375 Passenger 54.005 4 290 112.2 72 196.7 3.89 22.5 22 3/29/2012 124.4467163
Lexus LX470 9.126 Car 60.105 4.7 230 112.2 76.4 192.5 5.401 25.4 15 10/30/2012 105.760458
Lexus RX300 51.238 Car 34.605 3 220 103 71.5 180.1 3.9 17.2 21 1/4/2012 91.94380156
Lincoln Continental 13.798 20.525 Passenger 39.08 4.6 275 109 73.6 208.5 3.868 20 22 8/3/2012 113.5402069
Lincoln Town car 48.911 21.725 Passenger 43.33 4.6 215 117.7 78.2 215.3 4.121 19 21 6/4/2012 93.9579169
Lincoln Navigator 22.925 Car 42.66 5.4 300 119 79.9 204.8 5.393 30 15 12/23/2012 123.9720467
Mitsubishi Mirage 26.232 8.325 Passenger 13.987 1.8 113 98.4 66.5 173.6 2.25 13.2 30 4/23/2012 45.83218056
Mitsubishi Eclipse 42.541 10.395 Passenger 19.047 2.4 154 100.8 68.9 175.4 2.91 15.9 24 11/24/2012 62.44196235
Mitsubishi Galant 55.616 10.595 Passenger 17.357 2.4 145 103.7 68.5 187.8 2.945 16.3 25 1/29/2012 58.60677292
Mitsubishi Diamante 5.711 16.575 Passenger 24.997 3.5 210 107.1 70.3 194.1 3.443 19 22 8/28/2012 84.83077858
Mitsubishi 3000GT 0.11 20.94 Passenger 25.45 3 161 97.2 72.4 180.3 3.131 19.8 21 6/29/2012 67.54415494
Mitsubishi Montero 11.337 19.125 Car 31.807 3.5 200 107.3 69.9 186.6 4.52 24.3 18 1/17/2012 83.92081504
Mitsubishi Montero Sport 39.348 13.88 Car 22.527 3 173 107.3 66.7 178.3 3.51 19.5 20 5/18/2012 70.66094179
Mercury Mystique 14.351 8.8 Passenger 16.24 2 125 106.5 69.1 184.8 2.769 15 28 12/19/2012 50.99774761
Mercury Cougar 26.529 13.89 Passenger 16.54 2 125 106.4 69.6 185 2.892 16 30 2/23/2012 51.11347426
Mercury Sable 67.956 11.03 Passenger 19.035 3 153 108.5 73 199.7 3.379 16 24 9/22/2012 62.23996663
Mercury Grand Marquis 81.174 14.875 Passenger 22.605 4.6 200 114.7 78.2 212 3.958 19 21 7/24/2012 80.65769646
Mercury Mountaineer 27.609 20.43 Car 27.56 4 210 111.6 70.2 190.1 3.876 21 18 2/13/2008 85.94974425
Mercury Villager 20.38 14.795 Car 22.51 3.3 170 112.2 74.9 194.7 3.944 20 21 10/20/2009 69.671461
Mercedes-B C-Class 18.392 26.05 Passenger 31.75 2.3 185 105.9 67.7 177.4 3.25 16.4 26 4/24/2011 78.28073088
Mercedes-B E-Class 27.602 41.45 Passenger 49.9 3.2 221 111.5 70.8 189.4 3.823 21.1 25 7/12/2011 98.2497375
Mercedes-B S-Class 16.774 50.375 Passenger 69.7 4.3 275 121.5 73.1 203.1 4.133 23.2 21 6/13/2011 125.2738757
Mercedes-B SL-Class 3.311 58.6 Passenger 82.6 5 302 99 71.3 177.1 4.125 21.1 20 3/17/2011 139.9822936
Mercedes-B SLK 7.998 Passenger 38.9 2.3 190 94.5 67.5 157.9 3.055 15.9 26 1/16/2011 82.80736193
Mercedes-B SLK230 1.526 Passenger 41 2.3 185 94.5 67.5 157.3 2.975 14 27 8/6/2011 81.84896924
Mercedes-B CLK Coupe 11.592 Passenger 41.6 3.2 215 105.9 67.8 180.3 3.213 16.4 26 7/8/2011 92.92579177
Mercedes-B CL500 0.954 Passenger 85.5 5 302 113.6 73.1 196.6 4.115 23.2 20 4/11/2011 141.1009845
Mercedes-B M-Class 28.976 Car 35.3 3.2 215 111 72.2 180.6 4.387 19 20 2/10/2011 90.49553213
Nissan Sentra 42.643 8.45 Passenger 13.499 1.8 126 99.8 67.3 177.5 2.593 13.2 30 8/31/2011 50.24197791
Nissan Altima 88.094 11.295 Passenger 20.39 2.4 155 103.1 69.1 183.5 3.012 15.9 25 8/2/2011 63.31372783
Nissan Maxima 79.853 15.125 Passenger 26.249 3 222 108.3 70.3 190.5 3.294 18.5 25 5/6/2011 89.42782031
Nissan Quest 27.308 15.38 Car 26.399 3.3 170 112.2 74.9 194.8 3.991 20 21 3/7/2011 71.17166413
Nissan Pathfinder 42.574 17.81 Car 29.299 3.3 170 106.3 71.7 182.6 3.947 21 19 9/25/2011 72.29035508
Nissan Xterra 54.158 Car 22.799 3.3 170 104.3 70.4 178 3.821 19.4 18 1/24/2011 69.78294434
Nissan Frontier 65.005 Car 17.89 3.3 170 116.1 66.5 196.1 3.217 19.4 18 8/27/2011 67.88927059
Oldsmobile Cutlass 1.112 11.24 Passenger 18.145 3.1 150 107 69.4 192 3.102 15.2 25 5/31/2011 60.86161155
Oldsmobile Intrigue 38.554 Passenger 24.15 3.5 215 109 73.6 195.9 3.455 18 4/1/2011 86.27252291
Oldsmobile Alero 80.255 Passenger 18.27 2.4 150 107 70.1 186.7 2.958 15 27 10/20/2009 60.72744693
Oldsmobile Aurora 14.69 19.89 Passenger 36.229 4 250 113.8 74.4 205.4 3.967 18.5 22 2/18/2011 103.4416926
Oldsmobile Bravada 20.017 19.925 Car 31.598 4.3 190 107 67.8 181.2 4.068 17.5 19 9/21/2011 80.51167259
Oldsmobile Silhouette 24.361 15.24 Car 25.345 3.4 185 120 72.2 201.4 3.948 25 22 6/25/2011 76.09657042
Plymouth Neon 32.734 7.75 Passenger 12.64 2 132 105 74.4 174.4 2.559 12.5 29 4/26/2011 52.08489875
Plymouth Breeze 5.24 9.8 Passenger 16.08 2 132 108 71 186.3 2.942 16 27 11/14/2011 53.41189767
Plymouth Voyager 24.155 12.025 Car 18.85 2.4 150 113.3 76.8 186.3 3.528 20 24 4/24/2011 60.95118512
Plymouth Prowler 1.872 Passenger 43 3.5 253 113.3 76.3 165.4 2.85 12 21 6/27/2012 106.9844563
Pontiac Sunfire 51.645 13.79 Passenger 21.61 2.4 150 104.1 68.4 181.9 2.906 15 27 1/25/2012 62.0158703
Pontiac Grand Am 131.097 10.29 Passenger 19.72 3.4 175 107 70.4 186.3 3.091 15.2 25 11/26/2012 70.38973726
Pontiac Firebird 19.911 17.805 Passenger 25.31 3.8 200 101.1 74.5 193.4 3.492 16.8 25 6/16/2012 81.49272616
Pontiac Grand Prix 92.364 14.01 Passenger 21.665 3.8 195 110.5 72.7 196.5 3.396 18 25 10/15/2012 78.31816813
Pontiac Bonneville 35.945 13.225 Passenger 23.755 3.8 205 112.2 72.6 202.5 3.59 17.5 24 5/18/2011 82.6613556
Pontiac Montana 39.572 Car 25.635 3.4 185 120 72.7 201.3 3.942 25 23 7/22/2012 76.20843952
Porsche Boxter 8.982 41.25 Passenger 41.43 2.7 217 95.2 70.1 171 2.778 17 22 2/19/2012 93.4373307
Porsche Carrera Coupe 1.28 60.625 Passenger 71.02 3.4 300 92.6 69.5 174.5 3.032 17 21 12/21/2012 134.3909754
Porsche Carrera Cabrio 1.866 67.55 Passenger 74.97 3.4 300 92.6 69.5 174.5 3.075 17 23 7/11/2011 135.9147096
Saab 5-Sep 9.191 Passenger 33.12 2.3 170 106.4 70.6 189.2 3.28 18.5 23 11/9/2012 73.50377819
Saab 3-Sep 12.115 Passenger 26.1 2 185 102.6 67.4 182.2 2.99 16.9 23 6/12/2011 76.02304771
Saturn SL 80.62 9.2 Passenger 10.685 1.9 100 102.4 66.4 176.9 2.332 12.1 33 8/16/2012 39.98642475
Saturn SC 24.546 10.59 Passenger 12.535 1.9 100 102.4 66.4 180 2.367 12.1 33 3/16/2011 40.70007242
Saturn SW 5.223 10.79 Passenger 14.29 1.9 124 102.4 66.4 176.9 2.452 12.1 31 1/15/2011 49.86577367
Saturn LW 8.472 Passenger 18.835 2.2 137 106.5 69 190.4 3.075 13.1 27 8/5/2011 56.29524304
Saturn LS 49.989 Passenger 15.01 2.2 137 106.5 69 190.4 2.91 13.1 28 12/4/2012 54.81972825
Subaru Outback 47.107 Passenger 22.695 2.5 165 103.5 67.5 185.8 3.415 16.9 25 7/7/2011 67.7659076
Subaru Forester 33.028 Car 20.095 2.5 165 99.4 68.3 175.2 3.125 15.9 24 9/10/2012 66.76294331
Toyota Corolla 142.535 10.025 Passenger 13.108 1.8 120 97 66.7 174 2.42 13.2 33 4/11/2011 47.96897242
Toyota Camry 247.994 13.245 Passenger 17.518 2.2 133 105.2 70.1 188.5 2.998 18.5 27 2/10/2011 54.37241965
Toyota Avalon 63.849 18.14 Passenger 25.545 3 210 107.1 71.7 191.9 3.417 18.5 26 8/31/2011 84.91189826
Toyota Celica 33.269 15.445 Passenger 16.875 1.8 140 102.4 68.3 170.5 2.425 14.5 31 12/29/2012 56.49603034
Toyota Tacoma 84.087 9.575 Car 11.528 2.4 142 103.3 66.5 178.7 2.58 15.1 23 8/1/2011 55.29711658
Toyota Sienna 65.119 Car 22.368 3 194 114.2 73.4 193.5 3.759 20.9 22 10/5/2012 78.02721947
Toyota RAV4 25.106 13.325 Car 16.888 2 127 94.9 66.7 163.8 2.668 15.3 27 5/6/2011 51.95510887
Toyota 4Runner 68.411 19.425 Car 22.288 2.7 150 105.3 66.5 183.3 3.44 18.5 23 3/7/2011 62.35557713
Toyota Land Cruiser 9.835 34.08 Car 51.728 4.7 230 112.2 76.4 192.5 5.115 25.4 15 9/25/2011 102.5289842
Volkswagen Golf 9.761 11.425 Passenger 14.9 2 115 98.9 68.3 163.3 2.767 14.5 26 1/24/2011 46.94387676
Volkswagen Jetta 83.721 13.24 Passenger 16.7 2 115 98.9 68.3 172.3 2.853 14.5 26 8/27/2011 47.63823666
Volkswagen Passat 51.102 16.725 Passenger 21.2 1.8 150 106.4 68.5 184.1 3.043 16.4 27 10/30/2012 61.70138136
Volkswagen Cabrio 9.569 16.575 Passenger 19.99 2 115 97.4 66.7 160.4 3.079 13.7 26 5/31/2011 48.90737225
Volkswagen GTI 5.596 13.76 Passenger 17.5 2 115 98.9 68.3 163.3 2.762 14.6 26 4/1/2011 47.94684106
Volkswagen Beetle 49.463 Passenger 15.9 2 115 98.9 67.9 161.1 2.769 14.5 26 10/20/2011 47.32963226
Volvo S40 16.957 Passenger 23.4 1.9 160 100.5 67.6 176.6 2.998 15.8 25 2/18/2011 66.1130568
Volvo V40 3.545 Passenger 24.4 1.9 160 100.5 67.6 176.6 3.042 15.8 25 9/21/2011 66.4988123
Volvo S70 15.245 Passenger 27.5 2.4 168 104.9 69.3 185.9 3.208 17.9 25 11/24/2012 70.65449545
Volvo V70 17.531 Passenger 28.8 2.4 168 104.9 69.3 186.2 3.259 17.9 25 6/25/2011 71.1559776
Volvo C70 3.493 Passenger 45.5 2.3 236 104.9 71.5 185.7 3.601 18.5 23 4/26/2011 101.6233572
Volvo S80 18.969 Passenger 36 2.9 201 109.9 72.1 189.8 3.6 21.1 24 11/14/2011 85.73565451
'''
All possible library which is going to be used
here, in this small project.
'''
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#download the file
cars=pd.read_csv('cars.csv')
# check first five records from the Top
print(cars.head())
# check last five records from the bottom
print(cars.tail())
# information of dataset
print(cars.info())
# drop column if it is not important,if you want
#
drop_columns=['Acceleration','Weight']
cars=cars.drop(drop_columns,axis=1)
print(cars.info())
#drop duplicate rows if any
cars=cars.drop_duplicates(keep='first')
print(cars)
print(cars.shape)
#statistical information
print(cars.describe())
#sorting variables according to 'MPG'
cars_sort=cars.sort_values(by='MPG',ascending=False).head()
print(cars_sort)
# replace space from column
cars.columns=cars.columns.str.replace(' ','')
def min_max_value(col):
top=cars[col].idxmax()
top_obs=pd.DataFrame(cars.loc[top])
bot=cars[col].idxmin()
bot_obs=pd.DataFrame(cars.loc[bot])
top_bot_obs=pd.concat([top_obs,bot_obs],axis=1)
return top_bot_obs
max_val=min_max_value('MPG')
print(max_val)
#histogram of continuous variable
num_bins=10
plt.hist(cars['MPG'],bins=num_bins)
sns.distplot(cars['MPG'],bins=num_bins)
plt.hist(cars['Horsepower'],bins=num_bins)
# categorical data
origin_data=cars.groupby('Origin').size()
print(origin_data)
origin_data.plot(title='Origin Data')
#collect all numerical variables
cars_num=cars.select_dtypes(include=['float64','int64'])
print(cars_num.head())
cars_num.hist(bins=20)
#correlation with the variable of interest
cars_corr=cars_num.corr()['MPG'][:-1]
print(cars_corr)
#correlation plot using pair plot
for i in range(0,len(cars_num.columns),5):
sns.pairplot(data=cars_num,y_vars=['MPG'],x_vars=cars_num.columns[i:i+5])
# Plotting significant correlation in one plot (heatmap)
corr=cars_num.drop('MPG',axis=1).corr()
print(corr)
sns.heatmap(corr[(corr>=0.5)|(corr<=0.4)],cmap='viridis',vmax=1.0,vmin=1.0,linewidths=1.0,annot=True)
box1=sns.boxplot(x='Cylinders',y='MPG',data=cars)
#regression plot
sns.regplot(cars['MPG'],cars['Cylinders'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment