row_number() in pandas
one of the best code snippets i used to use all the time in my notebooks is row_number(), but in pandas:
dice_rolls['rn'] = dice_rolls.sort_values(['user_id', 'timestamp'], ascending=[True,True]) \
.groupby(['user_id']) \
.cumcount() + 1
honestly, it's strange there is no built-in function for this yet