Question: Problem 3a: The mpg dataset is in ggplot, not statsmodels: from ggplot import mpg Problem 3: Pivot tables 3a. Load the mpg R dataset from
Problem 3a: The mpg dataset is in ggplot, not statsmodels: from ggplot import mpg
Problem 3: Pivot tables
3a. Load the "mpg" R dataset from the Python statsmodels library into the variable mpg.
3b. Using the pandas pivot_table command, cretae a pandas DataFrame that tells you the average "cty" and "hwy" (city and highway miles per gallon) for each manufacturer.
3c. Has the average city mileage improved from 1999 to 2008? Has the average highway mileage improved from 1999 to 2008?
3d. Create a scatterplot of pairs (displ, hwy) for all cars in 1999, and another for all cars in 2008.
3e. What effect does increasing displacement have on highway gas mileage?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
