Skip to content

Commit

Permalink
chore: simplify Expr.clip (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli authored Aug 11, 2024
1 parent 435a079 commit 35e33d1
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions narwhals/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1810,8 +1810,8 @@ def gather_every(self: Self, n: int, offset: int = 0) -> Self:
# TODO @aivanoved: make type alias for numeric type
def clip(
self,
lower_bound: IntoExpr | Any | None = None,
upper_bound: IntoExpr | Any | None = None,
lower_bound: Any | None = None,
upper_bound: Any | None = None,
) -> Self:
r"""
Clip values in the Series.
Expand Down Expand Up @@ -1916,11 +1916,7 @@ def clip(
│ 3 │
└─────┘
"""
return self.__class__(
lambda plx: self._call(plx).clip(
extract_compliant(plx, lower_bound), extract_compliant(plx, upper_bound)
)
)
return self.__class__(lambda plx: self._call(plx).clip(lower_bound, upper_bound))

@property
def str(self: Self) -> ExprStringNamespace:
Expand Down

0 comments on commit 35e33d1

Please sign in to comment.