【发布时间】:2020-12-13 17:58:11
【问题描述】:
尝试在 Google colab 上运行一些 python 代码。我有一些预处理数据需要读入:
train, test, unused_feat, target_features, features, cat_idxs, cat_dims = pickle.load(open('/content/drive/My Drive/xxx/data/train_test.pkl', 'rb'))
然后如果我打电话给火车我会得到错误:
---------------------------------------------------------------------------
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'
当我打电话时
---------------------------------------------------------------------------
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
当我在自己的 jupyter notebook 上工作时,我对此没有任何问题。我想知道出了什么问题。同样 train 包含大约 250000 行。
【问题讨论】:
标签: python python-3.x pandas jupyter-notebook google-colaboratory