我有一个np.datetime64
Python 中的日期列表:
['2016-12-01T02:00:00.000000000', '2016-12-01T04:00:00.000000000',
'2016-12-01T06:00:00.000000000', '2016-12-01T08:00:00.000000000',
'2016-12-01T10:00:00.000000000', '2016-12-01T12:00:00.000000000',
'2016-12-01T14:00:00.000000000', '2016-12-01T16:00:00.000000000',
'2016-12-01T18:00:00.000000000', '2016-12-01T20:00:00.000000000',
'2016-12-01T22:00:00.000000000', '2016-12-02T00:00:00.000000000',
'2016-12-02T02:00:00.000000000', '2016-12-02T04:00:00.000000000',
'2016-12-02T06:00:00.000000000', '2016-12-02T08:00:00.000000000',
'2016-12-02T10:00:00.000000000', '2016-12-02T12:00:00.000000000',
'2016-12-02T14:00:00.000000000', '2016-12-02T16:00:00.000000000',
'2016-12-02T18:00:00.000000000', '2016-12-02T20:00:00.000000000',
'2016-12-02T22:00:00.000000000', '2016-12-03T00:00:00.000000000',
'2016-12-03T02:00:00.000000000', '2016-12-03T04:00:00.000000000',
'2016-12-03T06:00:00.000000000', '2016-12-03T08:00:00.000000000',
'2016-12-03T10:00:00.000000000', '2016-12-03T12:00:00.000000000',
'2016-12-03T14:00:00.000000000', '2016-12-03T16:00:00.000000000',
'2016-12-03T18:00:00.000000000', '2016-12-03T20:00:00.000000000',
'2016-12-03T22:00:00.000000000']
我希望遍历列表中的每个日历日。我试图从列表中提取每个唯一日期(即找到最小和最大日期并在它们之间创建一个日期列表),但这对于我想要做的事情并不理想。
我想要的结果是拥有允许我遍历列表中找到的每个日期/日历日并获取与该日期相对应的日期时间的代码:
for each_date in date_list:
***get all datetimes corresponding to each_date***
(loop would occur 3 times in this example)
笔记:
1) 迭代每个 [n:n+24] 的解决方案或任何不起作用的解决方案,因为不是每天都将具有相同数量的时间步长。