Hello I am trying to use Pandas rolling function to calculate a rolling difference on the table below. I am trying to produce the values in the Monthly available items column and not getting anywhere. Please help!
Item Adds Subtracts Month Monthly Available items
A 71 30 Jan 41
B 19 7 Jan 12
C 68 30 Jan 38
D 34 19 Jan 15
E 180 91 Jan 89
C 58 34 Feb 62
E 222 129 Feb 182
D 26 21 Feb 20
B 65 26 Feb 51
A 62 58 Feb 45
Python code so far:
rolling_triggers['Adds'].rolling(window = 2).apply(lambda x: x[1] - x[0])