Peace, I have the data in the following table: enter image description here
I need to get to the point where each row represents a client and the columns are months and each month the amount spent. Something like that
Thanks!!
CodePudding user response:
df['month'] = df.InvoiceDate.dt.to_period('M')
df.pivot_table(index='CustomerId', columns='month', values='TotalPrice', aggfunc='sum')