uqfoundation / dill

serialize all of Python

Home Page:http://dill.rtfd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pandas compatibility issue (No module named 'pandas.core.indexes.numeric')

xerxes-k opened this issue · comments

class Unpickler(StockUnpickler):
    """python's Unpickler extended to interpreter sessions and more types"""
    from .settings import settings
    _session = False

    def find_class(self, module, name):
        if (module, name) == ('__builtin__', '__main__'):
            return self._main.__dict__ #XXX: above set w/save_module_dict
        elif (module, name) == ('__builtin__', 'NoneType'):
            return type(None) #XXX: special case: NoneType missing
        if module == 'dill.dill': module = 'dill._dill'
        return StockUnpickler.find_class(self, module, name)

with pandas Version: 2.0.1, when using dill to load data, above code runs into moduleNotFound error

Can you give a minimal self-contained example of code that throws this error?
Also, what version of dill and what version of python and what OS did you test with?

I'm not experiencing an issue with a simple test:

Python 3.8.17 (default, Jun 11 2023, 01:54:00) 
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> import dill
>>> d = pd.DataFrame(dict(a=pd.Series(dict(q=2,w=3)), b=pd.Series(dict(q=4,t=5))))
>>> s = dill.loads(dill.dumps(d))
>>> s
     a    b
q  2.0  4.0
t  NaN  5.0
w  3.0  NaN
>>> 
>>> dill.__version__
'0.3.8.dev0'
>>> pd.__version__
'1.5.3'

Of course, you can see my pandas version is 1.5.3...
Can you give an example like this that triggers the error?

Also, was the same version of dill and/or pandas and/or python used to save and to load the data?

Also, was the same version of dill and/or pandas and/or python used to save and to load the data?

i believe this is the issue

the error happened when opening a file saved in colab. found out colab and my laptop have different versions of pandas