Fill in Order Details

  • Submit paper details for free using our simple order form

Make Payment Securely

  • Add funds to your account. There are no upfront payments. The writer will only be paid once you have approved your paper

Writing Process

  • The best qualified expert writer is assigned to work on your order
  • Your paper is written to standard and delivered as per your instructions

Download your paper

  • Download the completed paper from your online account or your email
  • You can request a plagiarism and quality report along with your paper

any help on this please

Overview

In this project, you will use the Pandas module to analyze some data about some 20th century car models, country of origin, miles per gallon, model year, etc.

Provided Input Files

An input file with nearly 200 rows of data about automobiles. The input file has the following format (the same as what you had for your chapter 13 labs). The following is an example of some of the lines in the file:

mpg,cylinders,displacement,horsepower,weight,acceleration,model_year,origin,name_x000D_
18,8,307,130,3504,12,70,usa,chevrolet chevelle malibu_x000D_
15,8,350,165,3693,11.5,70,usa,buick skylark 320_x000D_
18,8,318,150,3436,11,70,usa,plymouth satellite_x000D_
16,8,304,150,3433,12,70,usa,amc rebel sst_x000D_

Description

The first thing your program will need to do is prompt the user for a csv file name. Your prompt must be exactly Enter the filename:You will then read that csv file into a dataframe, and use that data in your analysis. If the file can not be opened, your program should not crash, but should print out the message Can't open file. Exiting program. and then exit the program.

You will use a menu, like in the last project, and call several functions according to the user’s menu selection.

You program should have a menu exactly as follows (the menu always prints a blank line first):

(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:_x000D_

If the user enters an invalid menu selection (including a non-numeric input, or a number outside of the valid range), your program should not crash, but should print the message Invalid selection - must be a number from 1 to 4, then display the menu again. For each menu selection other than Exit, you will first prompt the user for a country of origin. The prompt should be exactly Enter the country of origin: (with a space following the colon). The countries that are in the file are “usa”, “japan”, and “europe”. Then you will call a function for each menu selection and country that was input. If the user enters an unexpected input for the country, you should output the message Invalid country and then display the entire menu again, including the beginning blank line (you do not need to remember which menu item they selected).

An example of what output should look like for a sample of various inputs follows this description.

You will need to use the following functions:

  • def get_max_mpg_model(carsdataframe, country) – this function will accept as parameters a dataframe of data, with the same columns as the original file, and a country, which is a string. The function should return a string which is the name of the car model from the country indicated that has the maximum mpg of all models from that country. For example, if the user selected menu item 1 and then input ‘usa’, the get_max_mpg_model function will be passed a data frame and the string ‘usa’. It will return the string ‘chevrolet chevette’, since the chevrolet chevette is the model name with the best mpg among those models in the data whose country of origin is the usa. Upon return from the function with the above parameters, the following message should be printed: Best mpg model from usa is chevrolet chevette
  • def get_min_mpg_model(carsdataframe, country) – this function is the same as the get_max_mpg_model function, but will return the model name with the minimum mpg for the indicated country. The message printed upon return from the function would be something like Worst mpg model from usa is chevrolet chevette
  • def get_model_year_range(carsdataframe, country) – this function will take as parameters a dataframe and a country, like the other two, but this function will return two values, the minimum model year and the maximum model year for the indicated country. The message printed upon return from this function is, as an example Model years range from 1970 to 1975. Note that when the data is read into the data frame, the years are two digit integers. You will have to change them to strings in order to output the correct message.
  • Your code will be cleaner and much easier if you create a function that prints the menu.

In the main program, you should open the input file using the pandas read_csv() method and read the contents of the file into a DataFrame. Then display the menu to see what the user wants to do, and perform the function as indicated by the user.

Once the selected menu function has returned, the main program should print out the best (max) mpg model, the worst (min) mpg model, or the model year range according to the selected function, as follows:

Example: If the user inputs the following, in order:

mpg.csv_x000D_
1_x000D_
usa_x000D_
3_x000D_
japan_x000D_
2_x000D_
europe_x000D_
4_x000D_

the console will look like this:

Enter the filename:mpg.csv_x000D_
_x000D_
(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:1_x000D_
_x000D_
Enter the country of origin: usa_x000D_
Best mpg model from usa is: chevrolet chevette_x000D_
_x000D_
(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:3_x000D_
_x000D_
Enter the country of origin: japan_x000D_
Model years range from 1970 to 1975_x000D_
_x000D_
(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:2_x000D_
_x000D_
Enter the country of origin: europe_x000D_
Worst mpg model from europe is: volvo 145e (sw)_x000D_
_x000D_
(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:4_x000D_

If the user inputs a bogus file name, the output should look like this:

Enter the filename:bogusfilename_x000D_
Can't open file.  Exiting program._x000D_

If the user inputs an invalid menu choice, like -3 or end, the output should look like this:

Enter the filename:mpg.csv_x000D_
_x000D_
(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:-3_x000D_
Invalid selection - must be a number from 1 to 4_x000D_
_x000D_
(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:end_x000D_
Invalid selection - must be a number from 1 to 4_x000D_
_x000D_
(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:4_x000D_

If the user inputs an invalid country, such as australia, the output should look like this:

Enter the filename:mpg.csv_x000D_
_x000D_
(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:1_x000D_
_x000D_
Enter the country of origin: australia_x000D_
Invalid country_x000D_
_x000D_
(1) Get max mpg model_x000D_
(2) Get min mpg model_x000D_
(3) Get model year range_x000D_
(4) Exit_x000D_
_x000D_
Enter selection 1-4:4_x000D_

WHAT OUR CURRENT CUSTOMERS SAY

  • Google
  • Sitejabber
  • Trustpilot
Zahraa S
Zahraa S
Absolutely spot on. I have had the best experience with Elite Academic Research and all my work have scored highly. Thank you for your professionalism and using expert writers with vast and outstanding knowledge in their fields. I highly recommend any day and time.
Stuart L
Stuart L
Thanks for keeping me sane for getting everything out of the way, I’ve been stuck working more than full time and balancing the rest but I’m glad you’ve been ensuring my school work is taken care of. I'll recommend Elite Academic Research to anyone who seeks quality academic help, thank you so much!
Mindi D
Mindi D
Brilliant writers and awesome support team. You can tell by the depth of research and the quality of work delivered that the writers care deeply about delivering that perfect grade.
Samuel Y
Samuel Y
I really appreciate the work all your amazing writers do to ensure that my papers are always delivered on time and always of the highest quality. I was at a crossroads last semester and I almost dropped out of school because of the many issues that were bombarding but I am glad a friend referred me to you guys. You came up big for me and continue to do so. I just wish I knew about your services earlier.
Cindy L
Cindy L
You can't fault the paper quality and speed of delivery. I have been using these guys for the past 3 years and I not even once have they ever failed me. They deliver properly researched papers way ahead of time. Each time I think I have had the best their professional writers surprise me with even better quality work. Elite Academic Research is a true Gem among essay writing companies.
Got an A and plagiarism percent was less than 10%! Thanks!

ORDER NOW


Consider Your Assignments Done

“All my friends and I are getting help from eliteacademicresearch. It’s every college student’s best kept secret!”

Jermaine Byrant
BSN

“I was apprehensive at first. But I must say it was a great experience and well worth the price. I got an A!”

Nicole Johnson
Finance & Economics

Our Top Experts

See Why Our Clients Hire Us Again And Again!


OVER

10.3k
Reviews

RATING
4.89/5
Average

YEARS
13
Mastery

Success Guarantee

When you order form the best, some of your greatest problems as a student are solved!

Reliable

Professional

Affordable

Quick

Using this writing service is legal and is not prohibited by any law, university or college policies. Services of Elite Academic Research are provided for research and study purposes only with the intent to help students improve their writing and academic experience. We do not condone or encourage cheating, academic dishonesty, or any form of plagiarism. Our original, plagiarism-free, zero-AI expert samples should only be used as references. It is your responsibility to cite any outside sources appropriately. This service will be useful for students looking for quick, reliable, and efficient online class-help on a variety of topics.