human
Python Pandas Identify Duplicated rows with Additional Column
assistant
Here is some code to identify duplicated rows in columns 'PplNum' and 'RoomNum' with additional column in dataframe `df`

df.groupby(['PplNum', 'RoomNum']).cumcount() + 1

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.