I have a list of datetime containing year,month,day,hour,min,second and tzinfo, such as
In [1]:TimeCreate[0:4]
Out[1]:
[datetime.datetime(2011, 1, 1, 0, 0, 2),
datetime.datetime(2011, 1, 1, 0, 2, 2),
datetime.datetime(2011, 1, 1, 0, 27, 2),
datetime.datetime(2011, 1, 1, 1, 0, 2)]
I only want to select date and hour in the datetime, therefore, I can have the first three items as one class, i.e, I can summarize the number of repetition under each hour. How could I obtain the following format?
In [2]:TimeCreate[0:4]
Out[2]:
[datetime.datetime(2011, 1, 1, 0),
datetime.datetime(2011, 1, 1, 0),
datetime.datetime(2011, 1, 1, 0),
datetime.datetime(2011, 1, 1, 1)]
Therefore, I can have information, such as 3 repetition at hour 0.
Thank very much