Session Ready
Exercise

Plotting Margins of Error over Time

In this exercise you will inspect changing home prices in Philadelphia, PA, using a line plot with error bars. The data come from ACS 1-year sample Table B25077. The estimates and margin of error for each year from 2011 to 2017 have been downloaded and concatenated into a pandas data frame named philly. ACS table variables for the estimate and margin of error have been renamed to median_home_value and median_home_value_moe, respectively. (See the data frame in the console.)

pandas has been imported as pd.

Instructions
100 XP
  • Import matplotlib.pyplot using the alias plt
  • Create column rmoe (to hold the median home value Relative MOE) as 100 times the margin of error column divided by the estimate column
  • print the data frame to inspect the Relative MOE
  • Create an error bar plot: set the first argument to "year"; set the second argument to the name of the median home value column; set parameter yerr to the median home value MOE column; finally, set the data argument to the philly data frame