I've got one Dataframe like:
id value block
1 a 1
2 a 1
3 a 2
4 a 2
5 b 3
6 c 4
And I want to change the value column to the next value based where the series changes. Like below. The change must be defined by the block column.
id value block
1 a 1
2 a 1
3 b 2
4 b 2
5 c 3
6 None 4
I thought about using shift but there are different lengths of continuity in the value column.
I think this should work somehow by using cumsum to detect the change.