def _arith_method(op, name, str_rep=None, default_axis=None, fill_zeros=None, **eval_kwargs):
 def wrapper(self, other):
  if isinstance(other, np.ndarray):
   if (len(self) != len(other)):
    raise AssertionError(('length mismatch: %d vs. %d' % (len(self), len(other))))
   if (not isinstance(other, ABCSparseArray)):
    dtype = getattr(other, 'dtype', None)
    other = SparseArray(other, fill_value=self.fill_value, dtype=dtype)
   return _sparse_array_op(self, other, op, name)
  elif is_scalar(other):
   with np.errstate(all='ignore'):
    fill = op(_get_fill(self), np.asarray(other))
    result = op(self.sp_values, other)
   return _wrap_result(name, result, self.sp_index, fill)
  else:
   raise TypeError(('operation with %s not supported' % type(other)))
 if name.startswith('__'):
  name = name[2:(-2)]
 wrapper.__name__ = name
 return wrapper

def _arith_method ( op , name , str_rep = None , default_axis = None , fill_zeros = None , ** eval_kwargs ) : def wrapper ( self , other ) : if isinstance ( other , np . ndarray ) : if ( len ( self ) != len ( other ) ) : raise AssertionError ( ( 'length mismatch: %d vs. %d' % ( len ( self ) , len ( other ) ) ) ) if ( not isinstance ( other , ABCSparseArray ) ) : dtype = getattr ( other , 'dtype' , None ) other = SparseArray ( other , fill_value = self . fill_value , dtype = dtype ) return _sparse_array_op ( self , other , op , name ) elif is_scalar ( other ) : with np . errstate ( all = 'ignore' ) : fill = op ( _get_fill ( self ) , np . asarray ( other ) ) result = op ( self . sp_values , other ) return _wrap_result ( name , result , self . sp_index , fill ) else : raise TypeError ( ( 'operation with %s not supported' % type ( other ) ) ) if name . startswith ( '__' ) : name = name [ 2 : ( - 2 ) ] wrapper . __name__ = name return wrapper
wrapper function for series arithmetic operations .