I have a list of datetime objects in python and want to aggregate them by the hour. For example if I have a datetime object for
[03/01/2012 00:12:12,
03/01/2012 00:55:12,
03/01/2012 01:12:12,
...]
I want to have a list of datetime objects for every hour along with a count of the number of datetime objects I have that fall into that bucket. For my example above I would want output of
[03/01/2012 00:00:00, 03/01/2012 01:00:00]
in one list and a count of the entries in another list: [2,1]
.