We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb6f704 commit 292eb32Copy full SHA for 292eb32
pandas/core/generic.py
@@ -381,8 +381,6 @@ def attrs(self) -> dict[Hashable, Any]:
381
>>> df.attrs
382
{'A': [10, 20, 30]}
383
"""
384
- if self._attrs is None:
385
- self._attrs = {}
386
return self._attrs
387
388
@attrs.setter
@@ -2126,6 +2124,8 @@ def __setstate__(self, state) -> None:
2126
2124
typ = state.get("_typ")
2127
2125
if typ is not None:
2128
attrs = state.get("_attrs", {})
+ if attrs is None: # should not happen, but better be on the safe side
+ attrs = {}
2129
object.__setattr__(self, "_attrs", attrs)
2130
flags = state.get("_flags", {"allows_duplicate_labels": True})
2131
object.__setattr__(self, "_flags", Flags(self, **flags))
0 commit comments