I need to get the amount for a certain time window and a certain step.
Below is my dataset.
TransactionDate PartyId AmountEur
0 2018-04-28 15754387 8.46
1 2018-04-29 15754387 31.82
2 2018-04-30 15754387 1389.43
3 2018-05-01 15754387 134.12
4 2018-05-02 15754387 44.16
5 2018-05-03 15754387 65.62
6 2018-05-04 15754387 20.50
7 2018-05-05 15754387 23.92
8 2018-05-07 15754387 17.41
9 2018-05-08 15754387 10.32
e.g for window=4 and step=1, should be obtained:
TransactionDate PartyId AmountEur Res
0 2018-04-28 15754387 8.46 8.46 (8.64)
1 2018-04-29 15754387 31.82 40.28 (8.46+31.82)
2 2018-04-30 15754387 1389.43 1429.71 (8.46+31.82+1389.43)
3 2018-05-01 15754387 134.12 1563.83 (8.46+31.82+1389.43+134.12)
4 2018-05-02 15754387 44.16 1599.53 (31.82+1389.43+134.12+44.16)
5 2018-05-03 15754387 65.62 1633.33 (1389.43+134.12+44.16+65.62)
6 2018-05-04 15754387 20.50 264.4 (134.12+44.16+65.62+20.50)
7 2018-05-05 15754387 23.92 154.2 (44.16+65.62+20.50+23.92)
8 2018-05-07 15754387 17.41 127.45 (65.62+20.50+23.92+17.41)
9 2018-05-08 15754387 10.32 72.15 (20.50+23.92+17.41+10.32)
Thanks to everyone who tries to help me!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…