Created
August 14, 2021 16:15
-
-
Save chepner/5b6645a183befb248db3779c1a1027f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
class ExtendedDF(pd.DataFrame): | |
def __init__(self, df: pd.DataFrame): | |
self.title = 'some dataframe' | |
super().__init__(df) | |
somedf = pd.DataFrame() | |
extdf = ExtendedDF(df=somedf) | |
produces | |
Traceback (most recent call last): | |
File "/Users/chepner/tmp.py", line 9, in <module> | |
extdf = ExtendedDF(df=somedf) | |
File "/Users/chepner/tmp.py", line 5, in __init__ | |
self.title = 'some dataframe' | |
File "/nix/store/96rbddcm9zswxvx3p2l3dn5f86sfwd20-python3-3.9.5-env/lib/python3.9/site-packages/pandas/core/generic.py", line 5490, in __setattr__ | |
existing = getattr(self, name) | |
File "/nix/store/96rbddcm9zswxvx3p2l3dn5f86sfwd20-python3-3.9.5-env/lib/python3.9/site-packages/pandas/core/generic.py", line 5463, in __getattr__ | |
if self._info_axis._can_hold_identifiers_and_holds_name(name): | |
File "/nix/store/96rbddcm9zswxvx3p2l3dn5f86sfwd20-python3-3.9.5-env/lib/python3.9/site-packages/pandas/core/generic.py", line 5463, in __getattr__ | |
if self._info_axis._can_hold_identifiers_and_holds_name(name): | |
File "/nix/store/96rbddcm9zswxvx3p2l3dn5f86sfwd20-python3-3.9.5-env/lib/python3.9/site-packages/pandas/core/generic.py", line 5463, in __getattr__ | |
if self._info_axis._can_hold_identifiers_and_holds_name(name): | |
[Previous line repeated 987 more times] | |
File "/nix/store/96rbddcm9zswxvx3p2l3dn5f86sfwd20-python3-3.9.5-env/lib/python3.9/site-packages/pandas/core/generic.py", line 547, in _info_axis | |
return getattr(self, self._info_axis_name) | |
File "/nix/store/96rbddcm9zswxvx3p2l3dn5f86sfwd20-python3-3.9.5-env/lib/python3.9/site-packages/pandas/core/generic.py", line 5461, in __getattr__ | |
return object.__getattribute__(self, name) | |
File "pandas/_libs/properties.pyx", line 62, in pandas._libs.properties.AxisProperty.__get__ | |
File "/nix/store/96rbddcm9zswxvx3p2l3dn5f86sfwd20-python3-3.9.5-env/lib/python3.9/site-packages/pandas/core/generic.py", line 5461, in __getattr__ | |
return object.__getattribute__(self, name) | |
RecursionError: maximum recursion depth exceeded while calling a Python object | |
Same if I try with Python 3.8. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment