Created
June 23, 2021 13:06
-
-
Save btseytlin/4b9f9d1d491178ac99fbb33acaf59700 to your computer and use it in GitHub Desktop.
Medium "How to actually forecast COVID-19" embed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df_smoothed = df.rolling(7).mean().round(5) | |
| df_smoothed.columns = [col + '_ma7' for col in df_smoothed.columns] | |
| full_df = pd.concat([df, df_smoothed], axis=1) | |
| for column in full_df.columns: | |
| if column.endswith('_ma7'): | |
| original_column = column.strip('_ma7') | |
| full_df[column] = full_df[column].fillna(full_df[original_column]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment