I am trying to find the occurrence and add the occurrence if it is repeating. I tried groupby.cumcount but it doesn't increment when a new value is there. I need the output as mentioned below if the description is confusing.
| col1 | col2 | |
|---|---|---|
| 0 | 1200 | 1 |
| 1 | 1300 | 2 |
| 2 | 1400 | 3 |
| 3 | 1400 | 3 |
| 4 | 1400 | 3 |
| 5 | 1300 | 2 |
| 6 | 1500 | 4 |
| 7 | 1500 | 4 |