【发布时间】:2017-07-20 11:48:20
【问题描述】:
我有一个熊猫数据框,其索引具有秒频:
DatetimeIndex(['2015-12-28 05:20:05', '2015-12-28 05:20:06',
'2015-12-28 05:20:07', '2015-12-28 05:20:08',
...
'2015-12-28 21:19:55', '2015-12-28 21:19:56',
'2015-12-28 21:19:57', '2015-12-28 21:19:58']
给定日期时间字符串列表,我想一次提取多行。我试过了:
df.loc[['2015-12-28 08:32:39', '2015-12-28 08:32:48']]
但我收到以下错误:
KeyError: "None of [['2015-12-28 08:32:39', '2015-12-28 08:32:48']] are in the [index]"
【问题讨论】:
标签: python pandas dataframe indexing