Skip to content

Commit ef31301

Browse files
authored
REF: use _unary_method for SparseArray.__abs__ (#43846)
1 parent 4f15df2 commit ef31301

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/arrays/sparse/array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,9 +1597,6 @@ def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
15971597
else:
15981598
return type(self)(result)
15991599

1600-
def __abs__(self):
1601-
return np.abs(self)
1602-
16031600
# ------------------------------------------------------------------------
16041601
# Ops
16051602
# ------------------------------------------------------------------------
@@ -1681,6 +1678,9 @@ def __neg__(self) -> SparseArray:
16811678
def __invert__(self) -> SparseArray:
16821679
return self._unary_method(operator.invert)
16831680

1681+
def __abs__(self) -> SparseArray:
1682+
return self._unary_method(operator.abs)
1683+
16841684
# ----------
16851685
# Formatting
16861686
# -----------

0 commit comments

Comments
 (0)