Reputation: 77
I need to groupby based on the year & month of the Date column so I have a clearer graph presentation and less sample-size.
df.groupby(df2['Date'])['¢/kWh'].mean()
This has helped me to have less sample size and a better presentation. However I need to further groupby based on the month and year.
Upvotes: 0
Views: 55
Reputation: 301
Try :
df.groupby(df2['Date'].astype(str).str[0:7])['¢/kWh'].mean()
Upvotes: 1