rolling-sum

how to do forward rolling sum in pandas?

how to do forward rolling sum in pandas? Question: I have this dataframe: dates = pd.date_range(start=’2016-01-01′, periods=20, freq=’d’) df = pd.DataFrame({‘A’: [1] * 20 + [2] * 12 + [3] * 8, ‘B’: np.concatenate((dates, dates)), ‘C’: np.arange(40)}) I sorted the data frame by Date: df.sort_values(‘B’,inplace=True) I am looking to do a forward rolling sum on …

Total answers: 6

Python – rolling functions for GroupBy object

Python – rolling functions for GroupBy object Question: I have a time series object grouped of the type <pandas.core.groupby.SeriesGroupBy object at 0x03F1A9F0>. grouped.sum() gives the desired result but I cannot get rolling_sum to work with the groupby object. Is there any way to apply rolling functions to groupby objects? For example: x = range(0, 6) …

Total answers: 5