1

Trying to run some python code on Google colab. I have some preprocessed data that I need to read in:

train, test, unused_feat, target_features, features, cat_idxs, cat_dims  = pickle.load(open('/content/drive/My Drive/xxx/data/train_test.pkl', 'rb'))

Then if I call train I get the error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/IPython/core/formatters.py in __call__(self, obj)
    697                 type_pprinters=self.type_printers,
    698                 deferred_pprinters=self.deferred_printers)
--> 699             printer.pretty(obj)
    700             printer.flush()
    701             return stream.getvalue()

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

/usr/local/lib/python3.6/dist-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'

and when I call

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
<ipython-input-35-5e6a15ce28a5> in <module>()
----> 1 train.shape

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

/usr/local/lib/python3.6/dist-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):

RecursionError: maximum recursion depth exceeded while calling a Python object

When I work on my own jupyter notebook I have no problem with this. I wonder what went wrong. Also train contains roughly 250000 rows.

Adam
  • 257
  • 3
  • 12

1 Answers1

1

I think you could change the recursion limit if that is your constraint, however, you might be in an endless loop.

This post tells you how to increase your recursion limit. What is the maximum recursion depth in Python, and how to increase it?

However, I am not sure about the other error you got. Hope it helps a bit.

Blanks
  • 108
  • 6