Reputation: 26859
I'm trying to plot the counts of some pandas dataframe columns, grouped by date:
by_date = data.groupby(data.index.day).count()
The data are correct, but the the data.index.day
I specified is no good for plotting purposes:
Is there a way of specifying that I want to group by Python Date objects, or am I doing this completely wrong?
Update: Dan Allan's resample
suggestion worked, but now the the xticks are unreadable. Should I be extracting them separately?
Upvotes: 2
Views: 227
Reputation: 35235
I think this task is more easily accomplished using resample
, not group
. How about
data.resample('D', how='count')
Upvotes: 1