Skip to content

Commit 6436926

Browse files
committed
use __finalize__ for attrs bin ops in series.py
1 parent 4da1786 commit 6436926

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/series.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5862,7 +5862,7 @@ def _cmp_method(self, other, op):
58625862
res_name = ops.get_op_result_name(self, other)
58635863

58645864
if not getattr(self, "attrs", None) and getattr(other, "attrs", None):
5865-
self.attrs = other.attrs
5865+
self.__finalize__(other)
58665866

58675867
if isinstance(other, Series) and not self._indexed_same(other):
58685868
raise ValueError("Can only compare identically-labeled Series objects")
@@ -5948,7 +5948,7 @@ def _binop(self, other: Series, func, level=None, fill_value=None) -> Series:
59485948
name = ops.get_op_result_name(self, other)
59495949

59505950
if not getattr(this, "attrs", None) and getattr(other, "attrs", None):
5951-
this.attrs = other.attrs
5951+
this.__finalize__(other)
59525952

59535953
out = this._construct_result(result, name)
59545954
return cast(Series, out)

0 commit comments

Comments
 (0)