How to groupby consecutive values in pandas DataFrame [duplicate]
This question already has answers here: Make Pandas groupby act similarly to itertools groupby (3 answers) Closed last year. I have a column in a DataFrame with values: [1, 1, -1, 1, -1, -1] How can I group them like this? [1,1] [-1] [1] [-1, -1] python pandas dataframe group-by cumsum 1 You can use […]