Question
please use python to solve this problem. please don't use pandas only functions ##need the code structure only even if the database contains NA values
please use python to solve this problem. please don't use pandas only functions
##need the code structure only even if the database contains NA values it is okay
Problem A text file (Car_sale2.txt) with information about some cars is provided to you. This is a screenshot of the first lines with the header (1st line). Actually, the figure shown below is the screenshot of the same file in csv format.
database:
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 17 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 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 RL 9 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 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 19 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 39 Passenger 62 4.2 310 113 74 198.2 3.902 23.7 21 2/27/2012 134.6568582
BMW 328i 9 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 18 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 92 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 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 28 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 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 64 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 16 27.1 Passenger 44.475 4.6 275 112.2 75 201 18.5 22 4/29/2011 115.6213578
Cadillac Eldorado 7 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 18.225 Passenger 31.01 3 200 107.4 70.3 194.8 3.77 18 22 9/28/2011 83.48309358
Cadillac Escalade 15 Car 46.225 5.7 255 117.5 77 201.2 5.572 30 15 4/17/2012 109.5091165
Chevrolet Cavalier 146 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 11.225 Passenger 16.535 3.1 170 107 69.4 190.4 3.051 15 25 3/19/2012 67.31446216
Chevrolet Lumina 25 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 43 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 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 18 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 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 22 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 108 Passenger 18.89 3.4 180 110.5 73 200 3.389 17 27 6/18/2011 71.83803944
Chrysler Sebring Coupe 8 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. 33 14.18 Passenger 24.495 2.5 168 106 69.2 193 3.332 16 24 11/17/2011 69.52135505
Chrysler Concorde 31 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 12.64 Passenger 16.48 2 132 108 71 186 2.911 16 27 10/6/2011 53.56619987
Chrysler LHS 13 17.325 Passenger 28.34 3.5 253 113 74.4 207.7 3.564 17 23 5/8/2012 101.3292807
Chrysler 300M 31 Passenger 29.185 3.5 253 113 74.4 197.8 3.567 17 23 2/10/2012 101.6552441
Dodge Neon 76 7.75 Passenger 12.64 2 132 105 74.4 174.4 2.567 12.5 29 12/12/2011 52.08489875
Dodge Avenger 5 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 10.185 Passenger 20.23 2.5 168 108 71 186 3.058 16 24 10/31/2011 67.87610784
Dodge Intrepid 88 12.275 Passenger 22.505 2.7 202 113 74.7 203.7 3.489 17 6/2/2012 80.83147017
Dodge Viper 1 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 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 17 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 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 11.26 Car 16.98 2.5 120 131 71.5 215 3.557 22 19 11/25/2011 49.64500177
Dodge Caravan 182 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 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 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 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 246 10.055 Passenger 17.885 3 155 108.5 73 197.6 3.368 16 24 12/20/2011 62.5037395
Ford Crown Victoria 63 14.21 Passenger 22.195 4.6 200 114.7 78.2 212 3.908 19 21 9/26/2011 80.49953671
Ford Explorer 277 16.64 Car 31.93 4 210 111.6 70.2 190.7 3.876 21 19 4/25/2012 87.63549578
Ford Windstar 156 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 23.575 Car 36.135 4.6 240 119 78.7 204.6 4.808 26 16 9/14/2012 100.0248023
Ford Ranger 221 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 541 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 200 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 231 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 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 13 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 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 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 67 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 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 24 19.69 Passenger 29.465 3 227 108.3 70.2 193.7 3.342 18.5 25 4/15/2012 92.43688923
Jeep Wrangler 56 13.475 Car 14.46 2.5 120 93.4 66.7 152 3.045 19 17 3/4/2012 48.67289791
Jeep Cherokee 81 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 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 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 13 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 Passenger 46.305 4 300 110.2 70.9 189.2 3.693 19.8 21 11/28/2012 125.0133574
Lexus LS400 6 40.375 Passenger 54.005 4 290 112.2 72 196.7 3.89 22.5 22 3/29/2012 124.4467163
Lincoln Continental 14 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 49 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 23 Car 42.66 5.4 300 119 79.9 204.8 5.393 30 15 12/23/2012 123.9720467
Mitsubishi Mirage 26 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 43 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 56 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 6 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 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 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 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 8.8 Passenger 16.24 2 125 106.5 69.1 184.8 2.769 15 28 12/19/2012 50.99774761
Mercury Cougar 27 13.89 Passenger 16.54 2 125 106.4 69.6 185 2.892 16 30 2/23/2012 51.11347426
Mercury Sable 68 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 14.875 Passenger 22.605 4.6 200 114.7 78.2 212 3.958 19 21 7/24/2012 80.65769646
Mercury Mountaineer 28 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 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 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 28 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 17 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 58.6 Passenger 82.6 5 302 99 71.3 177.1 4.125 21.1 20 3/17/2011 139.9822936
Nissan Sentra 43 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 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 80 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 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 43 17.81 Car 29.299 3.3 170 106.3 71.7 182.6 3.947 21 19 9/25/2011 72.29035508
Oldsmobile Cutlass 1 11.24 Passenger 18.145 3.1 150 107 69.4 192 3.102 15.2 25 5/31/2011 60.86161155
Oldsmobile Aurora 15 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 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 15.24 Car 25.345 3.4 185 120 72.2 201.4 3.948 25 22 6/25/2011 76.09657042
Plymouth Neon 33 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 9.8 Passenger 16.08 2 132 108 71 186.3 2.942 16 27 11/14/2011 53.41189767
Plymouth Voyager 24 12.025 Car 18.85 2.4 150 113.3 76.8 186.3 3.528 20 24 4/24/2011 60.95118512
Pontiac Sunfire 52 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 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 20 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 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 36 13.225 Passenger 23.755 3.8 205 112.2 72.6 202.5 3.59 17.5 24 5/18/2011 82.6613556
Porsche Boxter 9 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 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 2 67.55 Passenger 74.97 3.4 300 92.6 69.5 174.5 3.075 17 23 7/11/2011 135.9147096
Saturn SL 81 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 25 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 10.79 Passenger 14.29 1.9 124 102.4 66.4 176.9 2.452 12.1 31 1/15/2011 49.86577367
Toyota Corolla 143 10.025 Passenger 13.108 1.8 120 97 66.7 174 2.42 13.2 33 4/11/2011 47.96897242
Toyota Camry 248 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 64 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 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 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 RAV4 25 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 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 10 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 10 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 84 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 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 10 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 6 13.76 Passenger 17.5 2 115 98.9 68.3 163.3 2.762 14.6 26 4/1/2011 47.94684106
Manufacturer Acura Aca 16.36 Acura Audi Audi Audi BMW BMW Buick Model Integra TL RL A4 AG AS 328 5281 Century Regal Park Avenue LeSabre Deville 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 16.919 Passenger 21.5 140 2012 2639 13.2 28 2/2/12 58.28014952 39.384 19.875 Passenger 28.4 3.2 225 1081 2013 1929 3.512 122 25 6/3/11 91.37077766 8.588 29.725 Passenger 3.5 210 1146 714 1966 3.85 22 3/10/11 91.38977933 20.397 22.255 Passenger 23.94 18 150 1026 2 178 2.998 16.4 27 10/8/11 62.7776392 18.78 23.555 Passenger 33.95 28 200 192 3.561 18.5 22 8/9/11 84.56510502 1.38 39 Passenger 62 42 310 74 1982 3.902 23.7 21 2/27/12 134.6568582 9.231 28.675 Passenger 28 193 107 685 125 3.197 16 24 1/29/12 81.87706856 17.527 36.125 Passenger 38.9 28 193 1114 2009 188 3.472 185 25 4/4/11 83.9987238 91.561 12.495 Passenger 21.975 175 109 72.7 1946 3.368 17.5 25 11/2/11 71.18145132 39.35 13.74 Passenger 25.3 3.8 240 109 723 1962 3.543 175 23 9/3/11 95.63670251 27.851 20.19 Passenger 31.965 38 113.8 747 2068 3.778 185 24 3/23/12 85.8284082 83.257 13.36 Passenger 27. 38 205 1122 735 200 3.591 17.5 25 7/23/11 84.25452581 63.724 22.525 Passenger 1153 745 2072 3.978 185 22 2/21/12 113.8545976 15.943 27.1 Passenger 44.45 275 1122 25 201 TRS 22 4/29/11 115.6213578 Buick Buick Cadillac Cadillac Objectives: 1. Display the names of the available car manufacturers. 2. Calculate the total profits of each car manufacturer. 3. Calculate the total profits for all car manufacturers. 4. Calculate the average fuel efficiency of all car manufacturers. 5. Display the car that are above and below average fuel efficiency as follows: === Car by fuel effeciency |Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started