0

NOT A DUPLICATE!!! It is NOT A DUPLICATE because: 1. I am using pickle to loads, and not pandas as the original question. 2. upgrading pandas does not help. 3. the original question was using the very same thing the accepted answer suggested. 4. other answers suggest changing the file which is not an option


I have an old pickle file I have to read.

I am reading using

def loads(s):
    try:
        content = pickle.loads(s)
    except TypeError:
        content = pickle.loads(str.encode(s), encoding='latin1')
    return content

reading the pickle fails the try (as expected), and then enters the except.

It then fails with

ModuleNotFoundError: No module named 'pandas.indexes'

How can I read that old pickle?

Gulzar
  • 23,452
  • 27
  • 113
  • 201
  • 1
    Does this answer your question? [ImportError: No module named 'pandas.indexes'](https://stackoverflow.com/questions/37371451/importerror-no-module-named-pandas-indexes) – zamir Jan 12 '20 at 16:42
  • No. It doesn't solve it because I have to read with `loads`, and not from file – Gulzar Jan 12 '20 at 17:17
  • Please vote to reopen this question! It is NOT A DUPLICATE because: 1. I am using pickle to loads, and not pandas as the original question. 2. upgrading pandas does not help. 3. the original question was using the very same thing the accepted answer suggested. 4. other answers suggest changing the file which is not an option. – Gulzar Jan 12 '20 at 17:29
  • _2. upgrading pandas does not help._ Upgrading to which version? How was the pickle created? – AMC Jan 12 '20 at 19:01
  • did you import pandas in the environment your are unpickling from? – Markus Rother Jan 13 '20 at 10:15
  • @AMC latest pandas version. `pip install pandas`, `pip install --upgrade pandas`. pandas 0.25.3 – Gulzar Jan 13 '20 at 10:48
  • @MarkusRotherthe pickle was created with pandas 0.19.0 – Gulzar Jan 13 '20 at 10:50

0 Answers0