Session Ready
Exercise

Add summary statistics to your time series plot

It is possible to visualize time series plots and numerical summaries on one single graph by using the pandas API to matplotlib along with the table method:

# Plot the time series data in the DataFrame
ax = df.plot()

# Compute summary statistics of the df DataFrame
df_summary = df.describe()

# Add summary table information to the plot
ax.table(cellText=df_summary.values, 
         colWidths=[0.3]*len(df.columns), 
         rowLabels=df_summary.index, 
         colLabels=df_summary.columns, 
         loc='top')
Instructions
100 XP

Review meat_mean in the shell -- a DataFrame that contains the mean of all the time series in meat.

  • Assign all the values in meat_mean to the cellText argument.
  • Assign all the values in index of meat_mean to the rowLabels argument.
  • Assign the column names of meat_mean to the colLabels argument.