Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create a class called CarsAnalysis, that contains some analysis on the cars.csv dataset you received during the final exam. This code will be saved in

create a class called CarsAnalysis, that
contains some analysis on the cars.csv dataset you received during the final exam. This code
will be saved in
Q1.py
The class CarsAnalysis will contain two class methods:
a)(4 points possible) Class method diesel_cars that gets one argument filepath (of type
string) that contains the full path for the cars.csv file. The method reads the csv file into
a pandas dataframe, processes it, and plots a pie chart that shows the make of cars that
have fuel type diesel. The pie chart will show as labels the make, as well as the number
of cars that fall into that category (that make, and they are of fuel type diesel). The
plotted graph should have a suggestive title, and will be saved on disk as diesel_cars.png
(hint: do not forget to call plt.clf() after plt.savefig(figname) to clear the figure).
b)(4 points possible) Class method called body_styles_cars that gets one argument
filepath (of type string) that contains the full path for the cars.csv file. The method reads
the csv file into a pandas dataframe, processes it, and plots a bar chart that has on the x
axis the possible body styles of cars, and on the y axis the number of cars that fall into
that body style. The plotted graph should have a corresponding title, x label, and y label,
and will be saved on disk as body_styles_cars.png (hint: do not forget to call plt.clf()
after plt.savefig(figname) to clear the figure).
c)(15 points possible) Create class method called other_analysis that gets one argument
filepath (of type string) that contains the full path for the cars.csv file. The csv file is read
into a pandas dataframe. The method will create four analysis (different than the ones
from a and b). The results of these analysis must be plotted (i.e. create graphs) and
saved as images. After it processes each analysis, it will print on screen the Analysis
number (e.g. 'Analysis c1'), and a short message describing the analysis, and then save
that graph figure to disk. The result (plotted graph) of each of these four analyses will be
saved on disk as images in a .png file having names c1.png, c2.png, c3.png, c4.png. Note:
the plotted graphs must be readable, and must have descriptibe titles and labels. One of
one of the plot must be an X-Y plot. (hint: do not forget to call plt.clf() after
plt.savefig(figname) to clear the figure).
Code to be documented with comments describing each analysis. You will be graded
based on the correctness of the result and quality of the analysis. All the analysis must
be different. Two similar analysis will not count as two analysis. To receive any credit,
code must run without errors.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

What could other companies learn from this example?

Answered: 1 week ago