Skip to content

Commit bf5a943

Browse files
committed
recursion error
1 parent dea7dce commit bf5a943

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pandas/core/generic.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -5214,9 +5214,11 @@ def finalize_name(objs):
52145214
# import pdb; pdb.set_trace()
52155215
if isinstance(other, NDFrame):
52165216
for name in self._metadata:
5217-
if hasattr(other, name):
5218-
# require hasattr to avoid overwriting a valid Series.name
5219-
# with a getattr(DataFrame, 'name', None)
5217+
if name == "name" and getattr(other, "ndim", None) == 1:
5218+
# Calling hasattr(other, 'name') is bad for DataFrames with
5219+
# a name column.
5220+
object.__setattr__(self, name, getattr(other, name, None))
5221+
elif name != "name":
52205222
object.__setattr__(self, name, getattr(other, name, None))
52215223
elif method == "concat":
52225224
assert isinstance(other, _Concatenator)

0 commit comments

Comments
 (0)