Question
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,
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started