ModuleNotFoundError: No module named 'pandas.core.indexes'
ModuleNotFoundError: No module named 'pandas.core.indexes'
我编写这段代码是为了将数据集加载到数据框中。数据集在 pickle 文件中给出,但会引发错误:
ModuleNotFoundError: 没有名为 'pandas.core.indexes'
的模块
import pickle
import pandas
dbfile = open(dataset loction,'rb')
df = pickle.load(dbfile)
我尝试了所有给出的修复:
- 更新了 pandas
- 用过
df = pandas.read_picle(dataset location)
尝试使用 pip 安装 pickle 但出现此错误
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 方法读取 .pk 文件。
import _pickle as cPickle
with open('filename.pkl', 'rb') as fo:
dict = cPickle.load(fo, encoding='latin1’)
在此处查看文档。 Pickle Read
感觉 pickle 文件是用不同版本的 Pandas 创建的,而您当前安装的 Pandas 没有 pandas.core.indexes
模块,某些数据在泡菜中需要。
您使用的 Pandas 是哪个版本?您尝试过升级吗?
编辑:Pandas 0.19.2 没有那个模块:
$ 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'
>>>
@AKX的回答让我意识到可能是版本问题Pandas。然而,我只需要升级。
pip install pandas --upgrade
我编写这段代码是为了将数据集加载到数据框中。数据集在 pickle 文件中给出,但会引发错误:
ModuleNotFoundError: 没有名为 'pandas.core.indexes'
的模块import pickle
import pandas
dbfile = open(dataset loction,'rb')
df = pickle.load(dbfile)
我尝试了所有给出的修复:
- 更新了 pandas
- 用过
df = pandas.read_picle(dataset location)
尝试使用 pip 安装 pickle 但出现此错误
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 方法读取 .pk 文件。
import _pickle as cPickle
with open('filename.pkl', 'rb') as fo:
dict = cPickle.load(fo, encoding='latin1’)
在此处查看文档。 Pickle Read
感觉 pickle 文件是用不同版本的 Pandas 创建的,而您当前安装的 Pandas 没有 pandas.core.indexes
模块,某些数据在泡菜中需要。
您使用的 Pandas 是哪个版本?您尝试过升级吗?
编辑:Pandas 0.19.2 没有那个模块:
$ 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'
>>>
@AKX的回答让我意识到可能是版本问题Pandas。然而,我只需要升级。
pip install pandas --upgrade