See this SO question:
Apparently (for a DataFrame with DatetimeIndex) drop requires a Timestamp object (this is different from ix/loc which can cunningly work out you meant a timestamp, if fed a string).
In [11]: df1
Out[11]:
Price1 Price2 Price3
Date_Time
2012-01-01 00:00:00 63.05 41.40 68.14
2012-01-01 01:00:00 68.20 42.44 59.64
2012-01-01 02:00:00 61.68 43.18 49.81
In [12]: df1.drop(pd.Timestamp('2012-01-01 01:00:00'))
Out[12]:
Price1 Price2 Price3
Date_Time
2012-01-01 00:00:00 63.05 41.40 68.14
2012-01-01 02:00:00 61.68 43.18 49.81
In [13]: df1.drop('2012-01-01 01:00:00')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-13-334d00239c8b> in <module>()
----> 1 df1.drop('2012-01-01 01:00:00')
/Users/234BroadWalk/pandas/pandas/core/generic.pyc in drop(self, labels, axis, level)
373 new_axis = axis.drop(labels, level=level)
374 else:
--> 375 new_axis = axis.drop(labels)
376 dropped = self.reindex(**{axis_name: new_axis})
377 try:
/Users/234BroadWalk/pandas/pandas/core/index.pyc in drop(self, labels)
1296 mask = indexer == -1
1297 if mask.any():
-> 1298 raise ValueError('labels %s not contained in axis' % labels[mask])
1299 return self.delete(indexer)
1300
ValueError: labels ['2012-01-01 01:00:00'] not contained in axis
Compare to ix/iloc which don't care:
In [21]: df1.loc['2012-01-01 01:00:00']
Out[21]:
Price1 68.20
Price2 42.44
Price3 59.64
Name: 2012-01-01 01:00:00, dtype: float64
In [22]: df1.loc[pd.Timestamp('2012-01-01 01:00:00')]
Out[22]:
Price1 68.20
Price2 42.44
Price3 59.64
Name: 2012-01-01 01:00:00, dtype: float64
Perhaps worth investigating where else this could work/not.
Comment From: mroeschke
Closing as a duplicate of #5355