我有一个看起来像这样的数据框:
GBPEUR
date
2018-06-22 1.140732
2018-06-25 1.135847
2018-06-26 1.134301
1900-01-01 NaN
df.列:
Index(['GBPEUR'], dtype='object')
df.index:
Index([2018-06-22, 2018-06-25, 2018-06-26, 1900-01-01], dtype='object', name='date')
我正在尝试做:
df = df.drop(index='1900-01-01')
但是我遇到了:
KeyError: "['1900-01-01'] not found in axis"
我真的很困惑,
1900-01-01
不是在轴上吗?
尝试:
df.drop('1900-01-01', axis=0)
输出:
GBPEUR
date
2018-06-22 1.140732
2018-06-25 1.135847
2018-06-26 1.134301