I have a DataFrame with two columns. One of them is containing timestamps and another one - id of some action. Something like that:
2000-12-29 00:10:00 a
You can get the counts by using
df.groupby([df.index.date, 'action']).count()
or you can plot directly using this method
df.groupby([df.index.date, 'action']).count().plot(kind='bar')
You could also just store the results to count
and then plot it separately. This is assuming that your index is already in datetimeindex format, otherwise follow the directions of @mkln above.
Starting from
mydate col_name
0 2000-12-29 00:10:00 action1
1 2000-12-29 00:20:00 action2
2 2000-12-29 00:30:00 action2
3 2000-12-29 00:40:00 action1
4 2000-12-29 00:50:00 action1
5 2000-12-31 00:10:00 action1
6 2000-12-31 00:20:00 action2
7 2000-12-31 00:30:00 action2
You can do
df['mydate'] = pd.to_datetime(df['mydate'])
df = df.set_index('mydate')
df['day'] = df.index.date
counts = df.groupby(['day', 'col_name']).agg(len)
but perhaps there's an even more straightforward way. the above should work anyway.
If you want to use counts as a DataFrame, I'd then transform it back
counts = pd.DataFrame(counts, columns=['count'])