Skip to content

Commit ef3c0b5

Browse files
committed
ENH: Ensure attrs are copied from other in Series arithmetic operations. Moved from base.py to series.py
1 parent 76b0831 commit ef3c0b5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pandas/core/base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,8 +1463,6 @@ def _duplicated(self, keep: DropKeep = "first") -> npt.NDArray[np.bool_]:
14631463
return algorithms.duplicated(arr, keep=keep)
14641464

14651465
def _arith_method(self, other, op):
1466-
if not getattr(self, "attrs", None) and getattr(other, "attrs", None):
1467-
self.__finalize__(other)
14681466
res_name = ops.get_op_result_name(self, other)
14691467

14701468
lvalues = self._values

pandas/core/series.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5888,6 +5888,8 @@ def _logical_method(self, other, op):
58885888

58895889
def _arith_method(self, other, op):
58905890
self, other = self._align_for_op(other)
5891+
if not getattr(self, "attrs", None) and getattr(other, "attrs", None):
5892+
self.attrs = other.attrs
58915893
return base.IndexOpsMixin._arith_method(self, other, op)
58925894

58935895
def _align_for_op(self, right, align_asobject: bool = False):

0 commit comments

Comments
 (0)