I have a pandas Dataframe with a column I would like to group them by pack of 3 rows and then increment an indice on each pack.
id protocol protocol_grp 1 ISD ISD1 2 ISD ISD1 3 ISD ISD1 4 IRQ IRQ1 5 IRQ IRQ1 6 IRQ IRQ1 7 IRQ IRQ2 8 IRQ IRQ2 9 IRQ IRQ2 10 IRQ IRQ3 11 ISD ISD2 12 ISD ISD2 13 ISD ISD2 14 ISD ISD3 15 IRQ IRQ3 16 IRQ IRQ3 17 IRQ IRQ4 The desired output is protocol_grp column. What I'd like to be able to do is each time I had 3 same protocols, I increment the indice by 1.
Hopes this make sense.