5,913
社区成员
D:\dev\Python\python3.12.4\python.exe C:\Users\HUANG\Desktop\毕业论文\语料库搭建\TF-IDF\TF-IDF.py
Traceback (most recent call last):
File "D:\dev\Python\python3.12.4\Lib\site-packages\pandas\core\indexes\base.py", line 3805, in get_loc
return self._engine.get_loc(casted_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
File "pandas\\_libs\\hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas\\_libs\\hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Name'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\HUANG\Desktop\毕业论文\语料库搭建\TF-IDF\TF-IDF.py", line 8, in <module>
corpus = df['Name'].tolist()
~~^^^^^^^^
File "D:\dev\Python\python3.12.4\Lib\site-packages\pandas\core\frame.py", line 4102, in __getitem__
indexer = self.columns.get_loc(key)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\dev\Python\python3.12.4\Lib\site-packages\pandas\core\indexes\base.py", line 3812, in get_loc
raise KeyError(key) from err
KeyError: 'Name'
是不是数据表中找不到Name这个关键字的字段