Sliding Window over Pandas Dataframe Sliding Window over Pandas Dataframe numpy numpy

Sliding Window over Pandas Dataframe


I think pandas rolling techniques are fine here. Note that starting with version 0.18.0 of pandas, you would use rolling().mean() instead of rolling_mean().

>>> df=pd.DataFrame({ 'x':range(30) })>>> df = df.rolling(10).mean()           # version 0.18.0 syntax>>> df[4::5]                             # take every 5th row       x4    NaN9    4.514   9.519  14.524  19.529  24.5