Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Needour task is to create a visual report for these data. You will create a single Matplotlib Figure containing the following subplots: A scatter plot

Needour task is to create a visual report for these data. You will create a single Matplotlib Figure containing the following subplots:
A scatter plot with all_weights on the x-axis and all_mpgs on the y-axis
A line plot with unique_model_years with separate y-axes for yearly_mean_mpgs and yearly_mean_horsepower. Include markers for each data point.
Two pie charts, one each for the number of models by origin in origins_1970 and origins_1980
A series of 6 bar plots with origin_mean_mpgs, origin_mean_horsepower, origin_mean_cylinders, origin_mean_displacement, origin_mean_weight, and origin_mean_acceleration on y-axis, and each should have unique_origins on the x-axis.
The subplots should use a layout with 3 rows:
Row 1, three subplots: Scatter plot (item 1 above),2 pie charts (item 3)
Row 2,1 subplot stretched across the figure: Line plot (item 2)
Row 3,6 subplots: 6 bar plots (item 4)
Be sure to give each subplot a title and label the axes with appropriate descriptor and units. You may customize the appearance (colors, marker types, etc.) in any way you think looks appealing to be written with python code, and here is the start codeimport pandas as pd
import seaborn as sns
data = sns.load_dataset('mpg')
all_mpgs = data['mpg'].to_list()
all_weights = data['weight'].to_list()
unique_model_years = list(data['model_year'].unique())
unique_origins = sorted(list(data['origin'].unique()))
yearly_mean_mpgs = data.groupby('model_year').mean(numeric_only=True)['mpg'].to_list()
yearly_mean_horsepower = data.groupby('model_year').mean(numeric_only=True)['horsepower'].to_list()
origins_1970= data.loc[data['model_year']==70, 'origin']
origins_1980= data.loc[data['model_year']==80, 'origin']
origin_mean_mpgs = data.groupby('origin').mean(numeric_only=True)['mpg'].to_list()
origin_mean_horsepower = data.groupby('origin').mean(numeric_only=True)['horsepower'].to_list()
origin_mean_cylinders = data.groupby('origin').mean(numeric_only=True)['cylinders'].to_list()
origin_mean_displacement = data.groupby('origin').mean(numeric_only=True)['displacement'].to_list()
origin_mean_weight = data.groupby('origin').mean(numeric_only=True)['weight'].to_list()
origin_mean_acceleration = data.groupby('origin').mean(numeric_only=True)['acceleration'].to_list()

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

Step: 3

blur-text-image

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

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions

Question

2. List the advantages of listening well

Answered: 1 week ago