I have a dataframe that contains a column that look like this
Name
A
A
B
B
C
I want to append a column to this dataframe where it contains the occurrence number of the item in Name
Name New_Column
A 1
A 2
B 1
B 2
C 1
So far, I can just turn Name column into a list, then loop over it and create the new_column, but is there a more straightforward way to do this directly in pandas?