Skip to content

Commit

Permalink
refactor[python]: Proper alias for abs (#4680)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Sep 2, 2022
1 parent ee00afe commit 41c93d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion py-polars/polars/internals/expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def __bool__(self) -> Expr:
)

def __abs__(self) -> Expr:
return wrap_expr(self._pyexpr.abs())
return self.abs()

def __invert__(self) -> Expr:
return self.is_not()
Expand Down
5 changes: 3 additions & 2 deletions py-polars/polars/internals/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from polars.internals.series.list import ListNameSpace
from polars.internals.series.string import StringNameSpace
from polars.internals.series.struct import StructNameSpace
from polars.internals.series.utils import call_expr, expr_dispatch, get_ffi_func
from polars.internals.series.utils import expr_dispatch, get_ffi_func
from polars.internals.slice import PolarsSlice
from polars.utils import (
_date_to_pl_date,
Expand Down Expand Up @@ -3739,7 +3739,8 @@ def abs(self) -> Series:
Same as `abs(series)`.
"""

__abs__ = call_expr(abs)
def __abs__(self) -> Series:
return self.abs()

def rank(self, method: RankMethod = "average", reverse: bool = False) -> Series:
"""
Expand Down

0 comments on commit 41c93d2

Please sign in to comment.