@@ -1401,12 +1401,6 @@ def _get_method_wrappers(cls):
1401
1401
arith_special = _arith_method_SERIES
1402
1402
comp_special = _comp_method_SERIES
1403
1403
bool_special = _bool_method_SERIES
1404
- elif issubclass (cls , ABCSparseArray ):
1405
- arith_flex = None
1406
- comp_flex = None
1407
- arith_special = _arith_method_SPARSE_ARRAY
1408
- comp_special = _arith_method_SPARSE_ARRAY
1409
- bool_special = _arith_method_SPARSE_ARRAY
1410
1404
elif issubclass (cls , ABCDataFrame ):
1411
1405
# Same for DataFrame and SparseDataFrame
1412
1406
arith_flex = _arith_method_FRAME
@@ -2336,47 +2330,6 @@ def _sparse_series_op(left, right, op, name):
2336
2330
return left ._constructor (result , index = new_index , name = new_name )
2337
2331
2338
2332
2339
- def _arith_method_SPARSE_ARRAY (cls , op , special ):
2340
- """
2341
- Wrapper function for Series arithmetic operations, to avoid
2342
- code duplication.
2343
- """
2344
- op_name = _get_op_name (op , special )
2345
-
2346
- def wrapper (self , other ):
2347
- from pandas .core .arrays .sparse .array import (
2348
- SparseArray ,
2349
- _sparse_array_op ,
2350
- _wrap_result ,
2351
- _get_fill ,
2352
- )
2353
-
2354
- if isinstance (other , np .ndarray ):
2355
- if len (self ) != len (other ):
2356
- raise AssertionError (
2357
- "length mismatch: {self} vs. {other}" .format (
2358
- self = len (self ), other = len (other )
2359
- )
2360
- )
2361
- if not isinstance (other , SparseArray ):
2362
- dtype = getattr (other , "dtype" , None )
2363
- other = SparseArray (other , fill_value = self .fill_value , dtype = dtype )
2364
- return _sparse_array_op (self , other , op , op_name )
2365
- elif is_scalar (other ):
2366
- with np .errstate (all = "ignore" ):
2367
- fill = op (_get_fill (self ), np .asarray (other ))
2368
- result = op (self .sp_values , other )
2369
-
2370
- return _wrap_result (op_name , result , self .sp_index , fill )
2371
- else : # pragma: no cover
2372
- raise TypeError (
2373
- "operation with {other} not supported" .format (other = type (other ))
2374
- )
2375
-
2376
- wrapper .__name__ = op_name
2377
- return wrapper
2378
-
2379
-
2380
2333
def maybe_dispatch_ufunc_to_dunder_op (
2381
2334
self : ArrayLike , ufunc : Callable , method : str , * inputs : ArrayLike , ** kwargs : Any
2382
2335
):
0 commit comments