Skip to content

Commit

Permalink
chore: Rename over args (#20952)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Jan 28, 2025
1 parent dd788d7 commit 96a2d01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions py-polars/polars/expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3412,8 +3412,8 @@ def over(
partition_by: IntoExpr | Iterable[IntoExpr],
*more_exprs: IntoExpr,
order_by: IntoExpr | Iterable[IntoExpr] | None = None,
order_by_descending: bool = False,
order_by_nulls_last: bool = False,
descending: bool = False,
nulls_last: bool = False,
mapping_strategy: WindowMappingStrategy = "group_to_rows",
) -> Expr:
"""
Expand All @@ -3436,10 +3436,10 @@ def over(
order_by
Order the window functions/aggregations with the partitioned groups by the
result of the expression passed to `order_by`.
order_by_descending
descending
In case 'order_by' is given, indicate whether to order in
ascending or descending order.
order_by_nulls_last
nulls_last
In case 'order_by' is given, indicate whether to order
the nulls in last position.
mapping_strategy: {'group_to_rows', 'join', 'explode'}
Expand Down Expand Up @@ -3579,7 +3579,7 @@ def over(
self._pyexpr.over(
partition_by,
order_by=order_by,
order_by_descending=order_by_descending,
order_by_descending=descending,
order_by_nulls_last=False, # does not work yet
mapping_strategy=mapping_strategy,
)
Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/operations/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def test_window_order_by_8662() -> None:
assert df.with_columns(
x_lag0=pl.col("x").shift(1).over("g"),
x_lag1=pl.col("x").shift(1).over("g", order_by="t"),
x_lag2=pl.col("x").shift(1).over("g", order_by="t", order_by_descending=True),
x_lag2=pl.col("x").shift(1).over("g", order_by="t", descending=True),
).to_dict(as_series=False) == {
"g": [1, 1, 1, 1, 2, 2, 2, 2],
"t": [1, 2, 3, 4, 4, 1, 2, 3],
Expand Down

0 comments on commit 96a2d01

Please sign in to comment.