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
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'])