Pandas Rolling_apply Cumprod
I am trying to get a rolling cumulative product to a series in pandas. My input series is: s 0 1 1 2 2 3 3 4 4 5 5 6 I would like to get a resulting series that gives me
Solution 1:
Thanks to user2357112. This is the code that I came up that works...
import pandas as pnd
df = pnd.DataFrame()
df['s'] = [1,2,3,4, 5, 6]
print (df)
print (pnd.rolling_apply(df.s,3,lambda x : x.prod()))
Post a Comment for "Pandas Rolling_apply Cumprod"