ImportError: No module named 'pandas.indexes'
I had this problem from trying to open a pickled dataframe made with pandas 0.18.1 using pandas 0.17.1. If you are using pip, upgrade pandas with:
pip install --upgrade pandas
If you are using a library like anaconda, use:
conda upgrade pandas
If you need to have both versions of pandas on your machine, consider using virtualenv
Saving and loading in different versions of pandas
using pickle
often does not work. Instead, use pandas.HDFStore
.
When I needed to update pandas but also needed some data saved with pickle in previous versions, I went back and re-saved that data in HDF format instead, when nothing else would work. No problems anymore.
Works for any sort of pandas data structure it seems, even multi-indexed dataframes! In short, if pickling fails after a version upgrade, try HDFStore; it's more reliable (and more efficient!).
I had this error when I created a pkl file with python 2.7 and was trying to read it with python 3.6 I did:
pd.read_pickle('foo.pkl')
and it worked