xinrong-databricks commented on a change in pull request #35840:
URL: https://github.com/apache/spark/pull/35840#discussion_r836596236



##########
File path: python/pyspark/pandas/frame.py
##########
@@ -7438,8 +7498,42 @@ def nsmallest(self, n: int, columns: Union[Name, 
List[Name]]) -> "DataFrame":
         0  1.0   6
         1  2.0   7
         2  3.0   8
+
+        The examples below show how ties are resolved, which is decided by 
`keep`.
+
+        >>> tied_df = ps.DataFrame({'X': [1, 1, 2, 2, 3]}, index=['a', 'b', 
'c', 'd', 'e'])

Review comment:
       We may tell diff from the index of the result, for example,
   
   ```py
           >>> tied_df.nlargest(3, 'X', keep='first')
              X
           d  3
           e  3
           b  2
   
           >>> tied_df.nlargest(3, 'X', keep='last')
              X
           e  3
           d  3
           c  2
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to