I am trying to calculate the rolling 3 days sum for the data below:
Date Qty
01/01/2019 4.15
02/01/2019 12.39
03/01/2019 14.15
04/01/2019 12.15
05/01/2019 3.26
06/01/2019 6.23
07/01/2019 15.89
08/01/2019 5.55
09/01/2019 12.49
10/01/2019 9.4
11/01/2019 9.11
12/01/2019 9.18
13/01/2019 13.45
14/01/2019 4.52
I tried:
data['Rolling_3_day'] = data['Qty'].rolling(3).sum()
But i got the following error:
AttributeError: 'Series' object has no attribute 'rolling'
I think the issue is that .rolling is added for Pandas V18 but I had Pandas V17. But I CAN NOT update pandas now.
Is there a way i can calculate rolling sum using V17?
question from:
https://stackoverflow.com/questions/66057294/how-can-i-replicate-rolling-sum-in-pandas-v17 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…