LeoPret
LeoPret

Reputation: 59

AWS Sagemaker Studio, cannot load pickle files

I'm a newbie in Sagemaker and i'm trying to load a pickle dataset into sagemaker notebook. I'm using the Python 3 (Data Science) kernel and ml.t3.medium instance. Either i load the pickle from S3 or I upload it directly from the studio like this:

import pickle5
with open('filename', 'rb') as f:
    x = pickle.load(f)

I get this Error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)
    700                 type_pprinters=self.type_printers,
    701                 deferred_pprinters=self.deferred_printers)
--> 702             printer.pretty(obj)
    703             printer.flush()
    704             return stream.getvalue()

..................... more errors here


/opt/conda/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5268             or name in self._accessors
   5269         ):
-> 5270             return object.__getattribute__(self, name)
   5271         else:
   5272             if self._info_axis._can_hold_identifiers_and_holds_name(name):

pandas/_libs/properties.pyx in pandas._libs.properties.AxisProperty.__get__()

/opt/conda/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5268             or name in self._accessors
   5269         ):
-> 5270             return object.__getattribute__(self, name)
   5271         else:
   5272             if self._info_axis._can_hold_identifiers_and_holds_name(name):

AttributeError: 'DataFrame' object has no attribute '_data'

Upvotes: 2

Views: 571

Answers (1)

Robert Kossendey
Robert Kossendey

Reputation: 6998

Can you check your Pandas versions? This error typically occurs when the pickled file was written in an old Pandas version. Your Sagemaker notebook probably runs Pandas > 1.1 where as the Pandas in which the dataframe was pickled is probably < 1.1

Upvotes: 2

Related Questions