Number rows within group in increasing order in a pandas dataframe
Given the following dataframe: import pandas as pd import numpy as np df = pd.DataFrame({'A': ['A','A','A','B','B','B'], 'B': ['a','a','b','a','a','a'], }) df ...