I have a dataframe:
StoreNumber Year
1000 2000
1000 2001
1000 2002
1001 2000
1001 2001
1001 2002
I want to add a column so that my final dataframe looks like:
StoreNumber Year New
1000 2000 1
1000 2001 2
1000 2002 3
1001 2000 1
1001 2001 2
1001 2002 3
I don't want the new row to depend upon StoreNumber which looks ovious in example. I want to start numbering with 1 and when I reach 3, then again start with 1. How do I do it?