Skip to content

Commit

Permalink
REF: use _unary_method for SparseArray.__abs__ (pandas-dev#43846)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored Oct 1, 2021
1 parent 4f15df2 commit ef31301
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pandas/core/arrays/sparse/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1597,9 +1597,6 @@ def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
else:
return type(self)(result)

def __abs__(self):
return np.abs(self)

# ------------------------------------------------------------------------
# Ops
# ------------------------------------------------------------------------
Expand Down Expand Up @@ -1681,6 +1678,9 @@ def __neg__(self) -> SparseArray:
def __invert__(self) -> SparseArray:
return self._unary_method(operator.invert)

def __abs__(self) -> SparseArray:
return self._unary_method(operator.abs)

# ----------
# Formatting
# -----------
Expand Down

0 comments on commit ef31301

Please sign in to comment.