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.api under the alias sm.
Subset df_run from 2013 through 2018, select Distance (km) column, resample weekly, and fill NaN values with the bfill() method. Assign to df_run_dist_wkly.
Create a plot with plt.figure(), defining plot size by setting figsize to (12,5).
Helpful links:
seasonal_decompose() using moving averages documentation