Task 8
Am I progressing?
Let's dive a little deeper into the data to answer a tricky question: am I progressing in terms of my running skills?
To answer this question, we'll decompose my weekly distance run and visually compare it to the raw data. A red trend line will represent the weekly distance run.
We are going to use statsmodels library to decompose the weekly trend.
Create a plot with observed distance of runs and decomposed trend.
Import the
statsmodels.apiunder the aliassm.Subset
df_runfrom 2013 through 2018, selectDistance (km)column, resample weekly, and fill NaN values with thebfill()method. Assign todf_run_dist_wkly.Create a plot with
plt.figure(), defining plot size by settingfigsizeto(12,5).
Helpful links:
seasonal_decompose()using moving averages documentation
Last updated
Was this helpful?