@@ -5269,7 +5269,7 @@ def _arith_op(left, right):
5269
5269
with np .errstate (all = "ignore" ):
5270
5270
res_values = _arith_op (this .values , other .values )
5271
5271
new_data = dispatch_fill_zeros (func , this .values , other .values , res_values )
5272
- return this ._construct_result (other , new_data , _arith_op )
5272
+ return this ._construct_result (new_data )
5273
5273
5274
5274
def _combine_match_index (self , other , func , level = None ):
5275
5275
left , right = self .align (other , join = "outer" , axis = 0 , level = level , copy = False )
@@ -5282,44 +5282,31 @@ def _combine_match_index(self, other, func, level=None):
5282
5282
# fastpath --> operate directly on values
5283
5283
with np .errstate (all = "ignore" ):
5284
5284
new_data = func (left .values .T , right .values ).T
5285
- return left ._construct_result (other , new_data , func )
5285
+ return left ._construct_result (new_data )
5286
5286
5287
5287
def _combine_match_columns (self , other : Series , func , level = None ):
5288
5288
left , right = self .align (other , join = "outer" , axis = 1 , level = level , copy = False )
5289
5289
# at this point we have `left.columns.equals(right.index)`
5290
5290
new_data = ops .dispatch_to_series (left , right , func , axis = "columns" )
5291
- return left ._construct_result (right , new_data , func )
5291
+ return left ._construct_result (new_data )
5292
5292
5293
- def _combine_const (self , other , func ):
5294
- # scalar other or np.ndim(other) == 0
5295
- new_data = ops .dispatch_to_series (self , other , func )
5296
- return self ._construct_result (other , new_data , func )
5297
-
5298
- def _construct_result (self , other , result , func ):
5293
+ def _construct_result (self , result ) -> "DataFrame" :
5299
5294
"""
5300
5295
Wrap the result of an arithmetic, comparison, or logical operation.
5301
5296
5302
5297
Parameters
5303
5298
----------
5304
- other : object
5305
5299
result : DataFrame
5306
- func : binary operator
5307
5300
5308
5301
Returns
5309
5302
-------
5310
5303
DataFrame
5311
-
5312
- Notes
5313
- -----
5314
- `func` is included for compat with SparseDataFrame signature, is not
5315
- needed here.
5316
5304
"""
5317
5305
out = self ._constructor (result , index = self .index , copy = False )
5318
5306
# Pin columns instead of passing to constructor for compat with
5319
5307
# non-unique columns case
5320
5308
out .columns = self .columns
5321
5309
return out
5322
- # TODO: finalize? we do for SparseDataFrame
5323
5310
5324
5311
def combine (self , other , func , fill_value = None , overwrite = True ):
5325
5312
"""
0 commit comments