Skip to content

Commit

Permalink
use __finalize__ for attrs bin ops in frame.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fbourgey committed Dec 2, 2024
1 parent c2c87dd commit 4da1786
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -7829,7 +7829,7 @@ def _cmp_method(self, other, op):
axis: Literal[1] = 1 # only relevant for Series other case

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

self, other = self._align_for_op(other, axis, flex=False, level=None)

Expand All @@ -7839,7 +7839,7 @@ def _cmp_method(self, other, op):

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

if self._should_reindex_frame_op(other, op, 1, None, None):
return self._arith_method_with_reindex(other, op)
Expand Down Expand Up @@ -8207,7 +8207,7 @@ def _flex_arith_method(
new_data = self._dispatch_frame_op(other, op)

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

return self._construct_result(new_data)

Expand Down Expand Up @@ -8248,7 +8248,7 @@ def _flex_cmp_method(self, other, op, *, axis: Axis = "columns", level=None):
self, other = self._align_for_op(other, axis, flex=True, level=level)

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

new_data = self._dispatch_frame_op(other, op, axis=axis)
return self._construct_result(new_data)
Expand Down

0 comments on commit 4da1786

Please sign in to comment.