Question:
Given dataframeThe idea is when column A row is equal with column A previous row, add 1, else back to 0
I’ve tried:
do i missed some steps or non logical operation here?
any hint will be very helpful
thank you in advance
Answer:
Let us trygroupby
and cumcount
:If you have better answer, please add a comment about this, thank you!