0

I want to figure out number of customers per week during 6 years and add an extra column of number. this is what I tried:

df = df_eind[['year', 'week']].copy()
countv = df.groupby(['year', 'week']).year.count()

and then joined it with the main table which has the customer information like this:

df4 = df_eind.join(countv)

but gives an error because can not join a series with a data frame. can you please help me.

the data is like this(ex):

 year     week
 2012      2
 2018      50
 2015      16
 2012       2

and the file view should be like this(ex):

year  week  count
2012    2      2
2015   16      1
2018   50      1
farzane
  • 41
  • 1
  • 1
  • 5

0 Answers0