idx = pd.DatetimeIndex([x['Date'] for x in test_docs], freq='D')
这是不正确的,因为时间没有被正确地从UTC转换回本地时间所以我遵循了中给出的解决方案idx = idx.tz_localizetz.tzlocal())
frame = DataFrame(test
我想计算DateTimeIndex中时间之间的时间差p = pd.DatetimeIndex(['1985-11-14', '1985-11-28', '1985dtype='datetime64[ns]')p[1] - p[0]Timedelta('14 days 00:00:00')DatetimeIndexto provide