Skip to content

Commit

Permalink
use __finalize__ for attrs bin ops in series.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fbourgey committed Dec 2, 2024
1 parent 4da1786 commit 6436926
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -5862,7 +5862,7 @@ def _cmp_method(self, other, op):
res_name = ops.get_op_result_name(self, other)

if not getattr(self, "attrs", None) and getattr(other, "attrs", None):
self.attrs = other.attrs
self.__finalize__(other)

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

if not getattr(this, "attrs", None) and getattr(other, "attrs", None):
this.attrs = other.attrs
this.__finalize__(other)

out = this._construct_result(result, name)
return cast(Series, out)
Expand Down

0 comments on commit 6436926

Please sign in to comment.