您的位置:首页技术文章
文章详情页

python - pandas出毛病了,重装也不行

【字号: 日期:2022-08-22 16:36:37浏览:9作者:猪猪

问题描述

Traceback (most recent call last): File 'C:UsersAdministratorAppDataRoamingPythonPython36site-packagespandasindexesbase.py', line 2134, in get_loc return self._engine.get_loc(key) File 'pandasindex.pyx', line 132, in pandas.index.IndexEngine.get_loc (pandasindex.c:4433) File 'pandasindex.pyx', line 154, in pandas.index.IndexEngine.get_loc (pandasindex.c:4279) File 'pandassrchashtable_class_helper.pxi', line 732, in pandas.hashtable.PyObjectHashTable.get_item (pandashashtable.c:13742) File 'pandassrchashtable_class_helper.pxi', line 740, in pandas.hashtable.PyObjectHashTable.get_item (pandashashtable.c:13696)KeyError: 0During handling of the above exception, another exception occurred:Traceback (most recent call last): File 'C:/Users/Administrator/PycharmProjects/untitled/test.py', line 5, in <module> code = today_data[0] File 'C:UsersAdministratorAppDataRoamingPythonPython36site-packagespandascoreframe.py', line 2059, in __getitem__ return self._getitem_column(key) File 'C:UsersAdministratorAppDataRoamingPythonPython36site-packagespandascoreframe.py', line 2066, in _getitem_column return self._get_item_cache(key) File 'C:UsersAdministratorAppDataRoamingPythonPython36site-packagespandascoregeneric.py', line 1386, in _get_item_cache values = self._data.get(item) File 'C:UsersAdministratorAppDataRoamingPythonPython36site-packagespandascoreinternals.py', line 3543, in get loc = self.items.get_loc(item) File 'C:UsersAdministratorAppDataRoamingPythonPython36site-packagespandasindexesbase.py', line 2136, in get_loc return self._engine.get_loc(self._maybe_cast_indexer(key)) File 'pandasindex.pyx', line 132, in pandas.index.IndexEngine.get_loc (pandasindex.c:4433) File 'pandasindex.pyx', line 154, in pandas.index.IndexEngine.get_loc (pandasindex.c:4279) File 'pandassrchashtable_class_helper.pxi', line 732, in pandas.hashtable.PyObjectHashTable.get_item (pandashashtable.c:13742) File 'pandassrchashtable_class_helper.pxi', line 740, in pandas.hashtable.PyObjectHashTable.get_item (pandashashtable.c:13696)KeyError: 0

这个错误我也是一脸懵,安装各种依赖库,卸载重装都不行,求大神指导

问题解答

回答1:

推荐使用Python的发行版Anaconda,自带各种数据处理包,不用额外安装该发行版使用conda包管理工具,可以有效避免pip安装导致的依赖错误,无法安装等问题如果觉得安装包比较大,可以试用精简版的Miniconda,需要额外下载安装。

如果使用conda下载速度比较慢,可以使用清华的镜像,清华conda镜像配置

标签: Python 编程