You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/03/10 06:15:30 UTC

[GitHub] [spark] xinrong-databricks commented on a change in pull request #35794: [SPARK-38491][PYTHON] Support `ignore_index` of `Series.sort_values`

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



##########
File path: python/pyspark/pandas/frame.py
##########
@@ -6901,6 +6904,16 @@ def sort_values(
         3     D     7     2
         2  None     8     4
 
+        Ignore index for the resulting axis
+
+        >>> df.sort_values(by=['col1'], ignore_index=True)
+           col1  col2  col3
+        0     A     2     0
+        1     B     9     9
+        2     C     4     3
+        3     D     7     2
+        4  None     8     4

Review comment:
       Thanks @itholic . The resulting index order is different considering different `ignore_index` input.
   ```py
           Sort by col1
   
           >>> df.sort_values(by=['col1'])
              col1  col2  col3
           0     A     2     0
           1     B     9     9
           4     C     4     3
           3     D     7     2
           2  None     8     4
   
           Ignore index for the resulting axis
   
           >>> df.sort_values(by=['col1'], ignore_index=True)
              col1  col2  col3
           0     A     2     0
           1     B     9     9
           2     C     4     3
           3     D     7     2
           4  None     8     4
   ```
   I may modify it if you still think it confusing though.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org