Assign id to item over groups with certain rules
Assign id to item over groups with certain rules Question: I have a dataframe looks like this df = pd.DataFrame({‘type’: [‘A’, ‘A’, ‘A’, ‘B’, ‘B’, ‘B’, ‘A’, ‘A’,’C’,’D’,’C’,’D’,’D’,’A’, ‘A’], }) I wanna create a unique id based on the group of the type column, but it will still cumsum when the type equals to ‘A’ …