Skip to content

Commit

Permalink
feat!: Remove deprecated top_k parameters (#16599)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego authored Jun 5, 2024
1 parent 6f3fd8e commit 077fda0
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 544 deletions.
54 changes: 2 additions & 52 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4727,8 +4727,6 @@ def top_k(
*,
by: IntoExpr | Iterable[IntoExpr],
descending: bool | Sequence[bool] = False,
nulls_last: bool | Sequence[bool] | None = None,
maintain_order: bool | None = None,
) -> DataFrame:
"""
Return the `k` largest rows.
Expand All @@ -4745,23 +4743,6 @@ def top_k(
largest). This can be specified per column by passing a sequence of
booleans.
nulls_last
Place null values last.
.. deprecated:: 0.20.31
This parameter will be removed in the next breaking release.
Null values will be considered lowest priority and will only be
included if `k` is larger than the number of non-null elements.
maintain_order
Whether the order should be maintained if elements are equal.
Note that if `true` streaming is not possible and performance might be
worse since this requires a stable search.
.. deprecated:: 0.20.31
This parameter will be removed in the next breaking release.
There will be no guarantees about the order of the output.
See Also
--------
bottom_k
Expand Down Expand Up @@ -4807,13 +4788,7 @@ def top_k(
"""
return (
self.lazy()
.top_k(
k,
by=by,
descending=descending,
nulls_last=nulls_last,
maintain_order=maintain_order,
)
.top_k(k, by=by, descending=descending)
.collect(
projection_pushdown=False,
predicate_pushdown=False,
Expand All @@ -4828,8 +4803,6 @@ def bottom_k(
*,
by: IntoExpr | Iterable[IntoExpr],
descending: bool | Sequence[bool] = False,
nulls_last: bool | Sequence[bool] | None = None,
maintain_order: bool | None = None,
) -> DataFrame:
"""
Return the `k` smallest rows.
Expand All @@ -4846,23 +4819,6 @@ def bottom_k(
smallest). This can be specified per column by passing a sequence of
booleans.
nulls_last
Place null values last.
.. deprecated:: 0.20.31
This parameter will be removed in the next breaking release.
Null values will be considered lowest priority and will only be
included if `k` is larger than the number of non-null elements.
maintain_order
Whether the order should be maintained if elements are equal.
Note that if `true` streaming is not possible and performance might be
worse since this requires a stable search.
.. deprecated:: 0.20.31
This parameter will be removed in the next breaking release.
There will be no guarantees about the order of the output.
See Also
--------
top_k
Expand Down Expand Up @@ -4908,13 +4864,7 @@ def bottom_k(
"""
return (
self.lazy()
.bottom_k(
k,
by=by,
descending=descending,
nulls_last=nulls_last,
maintain_order=maintain_order,
)
.bottom_k(k, by=by, descending=descending)
.collect(
projection_pushdown=False,
predicate_pushdown=False,
Expand Down
Loading

0 comments on commit 077fda0

Please sign in to comment.