Issue
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!!
Solution
df['month'] = df.InvoiceDate.dt.to_period('M')
df.pivot_table(index='CustomerId', columns='month', values='TotalPrice', aggfunc='sum')
Answered By - Jordan Hyatt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.