Currently the data frame is like this:
import pandas as pd
d = {'campaign': ['Fresh', 'Fresh', 'Fresh', 'General', 'General', 'Grocery', 'Grocery', 'Grocery'], 'week': ['7-4-22', '7-11-22', '7-18-22', '5-2-22', '5-9-22', '2-7-22',' 2-14-22',' 2-21-22']}
df = pd.DataFrame(data=d)
df
how do I insert a new column where it counts for the number of weeks in a sequential fashion without manually coding for each campaign, so that the end result would be
d = {'campaign': ['Fresh', 'Fresh', 'Fresh', 'General', 'General', 'Grocery', 'Grocery', 'Grocery'], 'week': ['7-4-22', '7-11-22', '7-18-22', '5-2-22', '5-9-22', '2-7-22',' 2-14-22',' 2-21-22'], 'week#':[1,2,3,1,2,1,2,3] }
df = pd.DataFrame(data=d)
df
I basically want the week# as an ordinal variable