0% found this document useful (0 votes)
2 views6 pages

Matplotlib Assignment Update

The document outlines a Matplotlib assignment consisting of three main tasks: analyzing student performance using a boxplot from a CSV file, visualizing sales data with a scatter plot based on discount rates, and exploring the Auto MPG dataset through data loading, cleaning, and various visualizations including scatter plots, histograms, and box plots. Each task requires specific data manipulation and plotting techniques using pandas and matplotlib. The assignment emphasizes the importance of proper labeling and data handling in visualizations.

Uploaded by

satyamkrop123ok
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Matplotlib Assignment Update

The document outlines a Matplotlib assignment consisting of three main tasks: analyzing student performance using a boxplot from a CSV file, visualizing sales data with a scatter plot based on discount rates, and exploring the Auto MPG dataset through data loading, cleaning, and various visualizations including scatter plots, histograms, and box plots. Each task requires specific data manipulation and plotting techniques using pandas and matplotlib. The assignment emphasizes the importance of proper labeling and data handling in visualizations.

Uploaded by

satyamkrop123ok
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Matplotlib Assignment

1. In order to assess the performance of students of a class in the annual


examination, the class teacher stored marks of the students in all the 5 subjects in
a CSV “[Link]” file as shown in Table. Plot the data using boxplot and
perform a comparative analysis of performance in each subject.
2. Prayatna sells designer bags and wallets. During the sales season, he offered
discounts ranging from 10% to 50% over a period of 5 weeks. He recorded his
sales for each discount rate in an array as follows:
Discounts (%) = [10, 20, 30, 40, 50]
Sales (in Rs.) = [40000, 45000, 48000, 50000, 100000].
Draw a scatter plot to show the relationship between the discount offered and the
sales made.

3. Analyze and visualize automobile fuel efficiency Auto MPG dataset using
`pandas` for data manipulation and `matplotlib` for plotting.
Dataset URL: `[Link]
mpg/[Link]`
Column Names: ['mpg', 'cylinders', 'displacement', 'horsepower', 'weight',
'acceleration', 'model_year', 'origin', 'car_name']
a. Data Loading and Cleaning
 Load the dataset using `pandas`.
 Assign proper column names.
 Handle missing values (hint: some rows have '?' in the `horsepower`
column).
 Convert the `horsepower` column to numeric type.
b. Scatter Plot: Horsepower vs MPG
 Create a scatter plot showing the relationship between “horsepower” and
“mpg”.
 Label the axes and title the plot appropriately.
 Use grid lines for better readability.

c. Histogram: Distribution of MPG


 Plot a histogram to show the frequency distribution of the `mpg` (miles per
gallon).
 Use appropriate number of bins (e.g., 15–20).
 Label the axes and add a title.
d. Box Plot: (MPG by Cylinders)
 Create a box plot showing the distribution of “mpg” grouped by the number
of “cylinders”.
 Each box should represent one cylinder group (e.g., 4, 6, 8).
 Add axis labels and a title.

(Answer is in next page.)

You might also like