GeorgeLin98 2019-12-19 17:09 采纳率: 0%
浏览 1000

KeyError: 'sepallength'问题

Traceback (most recent call last):
File "F:\Anaconda\lib\site-packages\pandas\core\indexes\base.py", line 2657, in get_loc
return self._engine.get_loc(key)
File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'sepallength'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Users/Shinelon/PycharmProjects/datamining/ShuJuWaJue/knnData.py", line 119, in
plt.scatter(x=t0['sepallength'][:50], y=t0['petallength'][:50], color='r', label='Iris-virginica')
File "F:\Anaconda\lib\site-packages\pandas\core\frame.py", line 2927, in getitem
indexer = self.columns.get_loc(key)
File "F:\Anaconda\lib\site-packages\pandas\core\indexes\base.py", line 2659, in get_loc
return self._engine.get_loc(self._maybe_cast_indexer(key))
File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'sepallength'
今天做鸢尾花数据的knn算法实验发生以下问题,请问哪里有问题啊,一直找不出来

  • 写回答

2条回答 默认 最新

  • 我想当码农呢~ 2022-04-20 11:09
    关注

    解决了吗,我也有这个问题

    评论

报告相同问题?