Skip to content Skip to sidebar Skip to footer

Dask Rolling Function By Group Syntax

I struggled for a while with the syntax to work for calculating a rolling function by group for a dask dataframe. The documentation is excellent, but in this case does not have an

Solution 1:

In order to retain the groups in the result:

ddf.groupby(by=User).apply(lambda df_g: df_g['x'].rolling(5).mean(), meta=('x', 'f8')).compute()

Post a Comment for "Dask Rolling Function By Group Syntax"