Is there a way to create a rolling window (2 periods) over a dataframe rows and compute the sum of the values?
My data:
ID Name Value1 Value2 Value3 Value4
0 A 2 2 4 4
1 B 1 1 3 3
The output desired:
ID Name Value1 Value2 Value3 Value4 Rol1 Rol2 Rol3
0 A 2 2 4 4 4 6 8
1 B 1 1 3 3 2 4 6
I tried to use df.rolling() but was only able to use it on a specific column