I have a dataframe with this form:
CLIENTCODE YEARMONTH
0 1 201301
1 1 201301
2 2 201301
3 1 201302
4 2 201302
5 2 201302
6 3 201302
I would like to add a new columns 'count' which contain the unique number of 'YEARMONTH' for each 'CLIENTCODE'.
So I did like this in python :
table.groupby('YEARMONTH').CLIENTCODE.nunique()
But I don't know how to add this as a columns in a dataframe.
Can you help me please?
Thanks