#s can be a series or a dataFrame for window in s.rolling(window=2): #windows size 2 print(window)
>>> df.rolling(2, min_periods=1).sum() B 0 0.0 1 1.0 2 3.0 3 2.0 4 4.0