diff --git a/py-polars/polars/dataframe/frame.py b/py-polars/polars/dataframe/frame.py index 9ca0ae0e7e65..4034f0331d0e 100644 --- a/py-polars/polars/dataframe/frame.py +++ b/py-polars/polars/dataframe/frame.py @@ -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. @@ -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) diff --git a/py-polars/polars/lazyframe/frame.py b/py-polars/polars/lazyframe/frame.py index 46ee33f618c1..cc4df14fdce6 100644 --- a/py-polars/polars/lazyframe/frame.py +++ b/py-polars/polars/lazyframe/frame.py @@ -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. @@ -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))