pyspark.pandas.Series.argsort#

Series.argsort()[source]#

Return the integer indices that would sort the Series values. Unlike pandas, the index order is not preserved in the result.

Returns:
Series

Positions of values within the sort order with -1 indicating nan values.

Examples

>>> psser = ps.Series([3, 3, 4, 1, 6, 2, 3, 7, 8, 7, 10])
>>> psser
0      3
1      3
2      4
3      1
4      6
5      2
6      3
7      7
8      8
9      7
10    10
dtype: int64
>>> psser.argsort().sort_index()
0      3
1      5
2      0
3      1
4      6
5      2
6      4
7      7
8      9
9      8
10    10
dtype: int64