itholic commented on code in PR #36186:
URL: https://github.com/apache/spark/pull/36186#discussion_r850865724
##########
python/pyspark/pandas/series.py:
##########
@@ -2834,57 +2855,69 @@ def sort_index(
na_position : {‘first’, ‘last’}, default ‘last’
first puts NaNs at the beginning, last puts NaNs at the end. Not
implemented for
MultiIndex.
+ ignore_index : bool, default False
+ If True, the resulting axis will be labeled 0, 1, …, n - 1.
+
+ .. versionadded:: 3.4.0
Returns
-------
sorted_obj : Series
Examples
--------
- >>> df = ps.Series([2, 1, np.nan], index=['b', 'a', np.nan])
+ >>> s = ps.Series([2, 1, np.nan], index=['b', 'a', np.nan])
- >>> df.sort_index()
+ >>> s.sort_index()
Review Comment:
+1
##########
python/pyspark/pandas/tests/test_series.py:
##########
@@ -998,6 +999,10 @@ def test_sort_values(self):
self.assert_eq(psser, pser.sort_values())
self.assert_eq(psdf, pdf)
+ psser.sort_values(inplace=True, ascending=False, ignore_index=True)
+ self.assert_eq(psser, pser.sort_values(ascending=False,
ignore_index=True))
+ self.assert_eq(psdf, pdf)
Review Comment:
```suggestion
psser.sort_values(inplace=True, ascending=False, ignore_index=True)
pser.sort_values(inplace=True, ascending=False, ignore_index=True)
self.assert_eq(psser, pser)
self.assert_eq(psdf, pdf)
```
##########
python/pyspark/pandas/tests/test_series.py:
##########
@@ -1032,6 +1039,10 @@ def test_sort_index(self):
self.assert_eq(psser, pser.sort_index())
self.assert_eq(psdf, pdf)
+ psser.sort_index(inplace=True, ascending=False, ignore_index=True)
+ self.assert_eq(psser, pser.sort_index(ascending=False,
ignore_index=True))
+ self.assert_eq(psdf, pdf)
Review Comment:
```suggestion
psser.sort_index(inplace=True, ascending=False, ignore_index=True)
pser.sort_index(inplace=True, ascending=False, ignore_index=True)
self.assert_eq(psser, pser)
self.assert_eq(psdf, pdf)
```
--
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]