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 05:27:31 UTC

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

itholic commented on a change in pull request #35794:
URL: https://github.com/apache/spark/pull/35794#discussion_r823359195



##########
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:
       Maybe can we refine the `df` by manually creating the index to show how `ignore_index` works more clearly??
   
   e.g.
   ```python
   df = ps.DataFrame({
       'col1': ['A', 'B', None, 'D', 'C'],
       'col2': [2, 9, 8, 7, 4],
       'col3': [0, 9, 4, 2, 3],
     },
     index=['idx1', 'idx2', 'idx3', 'idx4', 'idx5'],
     columns=['col1', 'col2', 'col3'])
   ```
   
   Seems like the current example shows the same result regardless of `ignore_index` value.




-- 
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