Skip to content

Commit 4da1786

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

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/core/frame.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7829,7 +7829,7 @@ def _cmp_method(self, other, op):
78297829
axis: Literal[1] = 1 # only relevant for Series other case
78307830

78317831
if not getattr(self, "attrs", None) and getattr(other, "attrs", None):
7832-
self.attrs = other.attrs
7832+
self.__finalize__(other)
78337833

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

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

78407840
def _arith_method(self, other, op):
78417841
if not getattr(self, "attrs", None) and getattr(other, "attrs", None):
7842-
self.attrs = other.attrs
7842+
self.__finalize__(other)
78437843

78447844
if self._should_reindex_frame_op(other, op, 1, None, None):
78457845
return self._arith_method_with_reindex(other, op)
@@ -8207,7 +8207,7 @@ def _flex_arith_method(
82078207
new_data = self._dispatch_frame_op(other, op)
82088208

82098209
if not getattr(self, "attrs", None) and getattr(other, "attrs", None):
8210-
self.attrs = other.attrs
8210+
self.__finalize__(other)
82118211

82128212
return self._construct_result(new_data)
82138213

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

82508250
if not getattr(self, "attrs", None) and getattr(other, "attrs", None):
8251-
self.attrs = other.attrs
8251+
self.__finalize__(other)
82528252

82538253
new_data = self._dispatch_frame_op(other, op, axis=axis)
82548254
return self._construct_result(new_data)

0 commit comments

Comments
 (0)