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

docs(python): Specify that the key column must be sorted in ascending order in merge_sorted #21501

Merged
merged 1 commit into from
Feb 27, 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
7 changes: 5 additions & 2 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -11535,8 +11535,9 @@ def merge_sorted(self, other: DataFrame, key: str) -> DataFrame:
Take two sorted DataFrames and merge them by the sorted key.

The output of this operation will also be sorted.
It is the callers responsibility that the frames are sorted
by that key otherwise the output will not make sense.
It is the callers responsibility that the frames
are sorted in ascending order by that key otherwise
the output will not make sense.

The schemas of both DataFrames must be equal.

Expand Down Expand Up @@ -11598,6 +11599,8 @@ def merge_sorted(self, other: DataFrame, key: str) -> DataFrame:
-----
No guarantee is given over the output row order when the key is equal
between the both dataframes.

The key must be sorted in ascending order.
"""
return self.lazy().merge_sorted(other.lazy(), key).collect(_eager=True)

Expand Down
7 changes: 5 additions & 2 deletions py-polars/polars/lazyframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -7096,8 +7096,9 @@ def merge_sorted(self, other: LazyFrame, key: str) -> LazyFrame:
Take two sorted DataFrames and merge them by the sorted key.

The output of this operation will also be sorted.
It is the callers responsibility that the frames are sorted
by that key otherwise the output will not make sense.
It is the callers responsibility that the frames
are sorted in ascending order by that key otherwise
the output will not make sense.

The schemas of both LazyFrames must be equal.

Expand Down Expand Up @@ -7159,6 +7160,8 @@ def merge_sorted(self, other: LazyFrame, key: str) -> LazyFrame:
-----
No guarantee is given over the output row order when the key is equal
between the both dataframes.

The key must be sorted in ascending order.
"""
return self._from_pyldf(self._ldf.merge_sorted(other._ldf, key))

Expand Down
Loading