Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'pandas.core.indexes'

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: No module named 'pandas.core.indexes'

import pickle
import pandas
dbfile = open(dataset loction,'rb')
df = pickle.load(dbfile)

I tried all the fixes given:

  1. Updated the pandas
  2. used df = pandas.read_picle(dataset location)

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
like image 367
RAMAN BHATIA Avatar asked Jul 11 '18 12:07

RAMAN BHATIA


2 Answers

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.

Which version of Pandas are you using? Have you tried upgrading?

EDIT: 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'
>>>
like image 143
AKX Avatar answered Sep 21 '22 15:09

AKX


The answer by @AKX made me realise that it was probably a version problem Pandas. However, I only needed to upgrade.

pip install pandas --upgrade
like image 41
ojunk Avatar answered Sep 20 '22 15:09

ojunk