I would like run a cumulative summary on two columns in a dataframe that look like this:
A B
1 1
1 2
1 3
1 4
1 5
2 6
2 7
2 8
3 9
3 10
And have the final dataframe to look like this:
A B
1 1
1 2
1 3
1 4
1 5
2 1
2 2
2 3
3 1
3 2
Essentially what I am as asking is how can I run a cumsum with a condition that every time col A changes, reset to 1 and start running the cumsum again?
Thanks!