前提・実現したいこと
初歩的な内容になりますが…
.dropで行の削除ができません。。。
n
#nの中
2018-06-04 0.013738
2018-06-05 0.002830
2018-06-06 0.003824
2018-06-07 0.008730
2018-06-08 -0.005642
2018-06-11 0.004827
2018-06-12 0.003259
2018-06-13 0.003848
2018-06-14 -0.009918
2018-06-15 0.004976
Name: ^N225_C, dtype: float64
#2018-06-04を削除
n.drop("2018-06-04")
とするとエラーが出ます。
ちなみに
n.indexを実行すると
DatetimeIndex(['2018-06-04', '2018-06-05', '2018-06-06', '2018-06-07',
'2018-06-08', '2018-06-11', '2018-06-12', '2018-06-13',
'2018-06-14', '2018-06-15'],
dtype='datetime64[ns]', freq=None)
とでます。
発生している問題・エラーメッセージ
ValueError Traceback (most recent call last) <ipython-input-95-eede912be6c7> in <module>() ----> 1 n.drop("2018-06-04") C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in drop(self, labels, axis, index, columns, level, inplace, errors) 2528 for axis, labels in axes.items(): 2529 if labels is not None: -> 2530 obj = obj._drop_axis(labels, axis, level=level, errors=errors) 2531 2532 if inplace: C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in _drop_axis(self, labels, axis, level, errors) 2560 new_axis = axis.drop(labels, level=level, errors=errors) 2561 else: -> 2562 new_axis = axis.drop(labels, errors=errors) 2563 dropped = self.reindex(**{axis_name: new_axis}) 2564 try: C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in drop(self, labels, errors) 3742 if errors != 'ignore': 3743 raise ValueError('labels %s not contained in axis' % -> 3744 labels[mask]) 3745 indexer = indexer[~mask] 3746 return self.delete(indexer) ValueError: labels ['2018-06-04'] not contained in axis
該当のソースコード
python
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。