@@ -7829,7 +7829,7 @@ def _cmp_method(self, other, op):
7829
7829
axis : Literal [1 ] = 1 # only relevant for Series other case
7830
7830
7831
7831
if not getattr (self , "attrs" , None ) and getattr (other , "attrs" , None ):
7832
- self .attrs = other . attrs
7832
+ self .__finalize__ ( other )
7833
7833
7834
7834
self , other = self ._align_for_op (other , axis , flex = False , level = None )
7835
7835
@@ -7839,7 +7839,7 @@ def _cmp_method(self, other, op):
7839
7839
7840
7840
def _arith_method (self , other , op ):
7841
7841
if not getattr (self , "attrs" , None ) and getattr (other , "attrs" , None ):
7842
- self .attrs = other . attrs
7842
+ self .__finalize__ ( other )
7843
7843
7844
7844
if self ._should_reindex_frame_op (other , op , 1 , None , None ):
7845
7845
return self ._arith_method_with_reindex (other , op )
@@ -8207,7 +8207,7 @@ def _flex_arith_method(
8207
8207
new_data = self ._dispatch_frame_op (other , op )
8208
8208
8209
8209
if not getattr (self , "attrs" , None ) and getattr (other , "attrs" , None ):
8210
- self .attrs = other . attrs
8210
+ self .__finalize__ ( other )
8211
8211
8212
8212
return self ._construct_result (new_data )
8213
8213
@@ -8248,7 +8248,7 @@ def _flex_cmp_method(self, other, op, *, axis: Axis = "columns", level=None):
8248
8248
self , other = self ._align_for_op (other , axis , flex = True , level = level )
8249
8249
8250
8250
if not getattr (self , "attrs" , None ) and getattr (other , "attrs" , None ):
8251
- self .attrs = other . attrs
8251
+ self .__finalize__ ( other )
8252
8252
8253
8253
new_data = self ._dispatch_frame_op (other , op , axis = axis )
8254
8254
return self ._construct_result (new_data )
0 commit comments