如何解决使用 Neo4j 向图形数据库添加数据时出现关键错误这个错误是什么意思?
我正在遵循本指南:https://towardsdatascience.com/create-a-graph-database-in-neo4j-using-python-4172d40f89c4
并且在运行 add_authors(authors) 和 add_papers(df) 函数时收到错误消息:
KeyError Traceback (most recent call last)
~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self,key,method,tolerance)
2645 try:
-> 2646 return self._engine.get_loc(key)
2647 except KeyError:
pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 10000
During handling of the above exception,another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-8-0d592471d0d9> in <module>
10
11 add_categories(categories)
---> 12 add_authors(authors)
13 add_papers(df)
<ipython-input-6-9e1a84525030> in add_authors(rows,batch_size)
16 RETURN count(*) as total
17 '''
---> 18 return insert_data(query,rows,batch_size)
19
20
<ipython-input-6-9e1a84525030> in insert_data(query,batch_size)
28
29 while batch * batch_size < len(rows):
---> 30 res = conn.query(query,parameters= {'rows':rows[(batch*batch_size+1)*batch_size].to_dict('records')})
31 total += res[0]['total']
32 batch += 1
~\anaconda3\lib\site-packages\pandas\core\frame.py in __getitem__(self,key)
2798 if self.columns.nlevels > 1:
2799 return self._getitem_multilevel(key)
-> 2800 indexer = self.columns.get_loc(key)
2801 if is_integer(indexer):
2802 indexer = [indexer]
~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self,tolerance)
2646 return self._engine.get_loc(key)
2647 except KeyError:
-> 2648 return self._engine.get_loc(self._maybe_cast_indexer(key))
2649 indexer = self.get_indexer([key],method=method,tolerance=tolerance)
2650 if indexer.ndim > 1 or indexer.size > 1:
pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 10000
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。