Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Rename over args #20952

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading