ModuleNotFoundError:没有名为“pandas.core.indexes"的模块 [英] ModuleNotFoundError: No module named 'pandas.core.indexes'
问题描述
我编写了这段代码来将数据集加载到数据框中.数据集在 pickle 文件中给出,但会引发错误:
I wrote this code to load a dataset into a data frame. Dataset is given in a pickle file but it throws an error:
ModuleNotFoundError:没有名为pandas.core.indexes"的模块
import pickle
import pandas
dbfile = open(dataset loction,'rb')
df = pickle.load(dbfile)
我尝试了所有给出的修复:
I tried all the fixes given:
- 更新了熊猫
- 使用
df = pandas.read_picle(dataset location)
尝试使用 pip 安装 pickle 但出现此错误
Tried installing pickle using pip but getting this error
C:\installs\WinPython-64bit-3.6.1.0Qt5\python-3.6.1.amd64>python -m pip install pickle
Collecting pickle
Could not find a version that satisfies the requirement pickle (from versions: )
No matching distribution found for pickle
推荐答案
这听起来像是使用不同版本的 Pandas 创建的 pickle 文件,而您当前安装的 Pandas 没有 pandas.core.索引
模块是pickle中的一些数据所需要的.
That smells like the pickle file has been created with a different version of Pandas, and your currently installed Pandas doesn't have the pandas.core.indexes
module that some of the data in the pickle requires.
您使用的是哪个版本的 Pandas?您是否尝试过升级?
Which version of Pandas are you using? Have you tried upgrading?
Pandas 0.19.2 没有该模块:
Pandas 0.19.2 does not have that module:
$ pip install pandas==0.23.3
$ python
>>> import pandas.core.indexes as i
>>>
$ pip install pandas==0.19.2
$ python
>>> import pandas.core.indexes as i
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas.core.indexes'
>>>
这篇关于ModuleNotFoundError:没有名为“pandas.core.indexes"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!