Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,6 @@ def attrs(self) -> dict[Hashable, Any]:
>>> df.attrs
{'A': [10, 20, 30]}
"""
if self._attrs is None:
self._attrs = {}
return self._attrs

@attrs.setter
Expand Down Expand Up @@ -2126,6 +2124,8 @@ def __setstate__(self, state) -> None:
typ = state.get("_typ")
if typ is not None:
attrs = state.get("_attrs", {})
if attrs is None: # should not happen, but better be on the safe side
attrs = {}
object.__setattr__(self, "_attrs", attrs)
flags = state.get("_flags", {"allows_duplicate_labels": True})
object.__setattr__(self, "_flags", Flags(self, **flags))
Expand Down