Python 看起来df.drop()不';为日期时间索引删除作业

Python 看起来df.drop()不';为日期时间索引删除作业,python,datetime,pandas,Python,Datetime,Pandas,看起来df.drop()没有按预期工作(注意索引是DatetimeIndex): 我错过什么了吗 date = '2014-07-16 14:24' 要删除范围,请执行以下操作: df = df[:date] # Drops anything after the date df = df[date:] # Drops anything before the date 要删除行,请执行以下操作: df = df.drop(Timestamp(date)) # Drops the row ind

看起来
df.drop()
没有按预期工作(注意索引是DatetimeIndex):

我错过什么了吗

date = '2014-07-16 14:24'
要删除范围,请执行以下操作:

df = df[:date] # Drops anything after the date
df = df[date:] # Drops anything before the date
要删除行,请执行以下操作:

df = df.drop(Timestamp(date)) # Drops the row indexed by the date
这并不是说下降不适用于日期。相反,它似乎不像切片索引那样自动将字符串转换为日期


检查。

2。我该怎么做才能缩小范围?Thnx请也打印数据帧的标题。我想看看哪些列是索引,以及这些列的名称。[quote]df.head()Out[51]:价格标askvol日期时间2014-07-16 10:00:00.006000 34911 10 2014-07-16 10:00:00.006000 34908 1 0 2014-07-16 10:00:00.006000 34907 5 0 2014-07-16 10:00-16 10:00.006000 34905 1 0 2014-07-16 10:00:00.006000 34905 2我是新来的。我试着:)thnx在测向仪的中间放置一个范围。thnxdf.index Out[50]:[2014-07-16 10:00:00.006000,…,2014-07-16 14:24:11.462000]长度:51225,频率:无,时区:无用于格式化。我要提高我的技能。
df = df.drop(Timestamp(date)) # Drops the row indexed by the date