Last active
August 13, 2022 06:58
-
-
Save dormeir999/e28447196f446c4154b0fc8ade002aa9 to your computer and use it in GitHub Desktop.
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
| assert df.isna().sum().sum() == 0 | |
| total_sales_5_days_rolling_window = df.groupby(['product','date']).sales.sum().rolling(5, min_periods=0).agg(['min','max','mean','sum']).add_prefix('country_sales_rolling_5_') | |
| df = df.merge(total_sales_5_days_rolling_window, on=['product','date'], how='left') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment