polars.Series.sort#

Series.sort(
*,
descending: bool = False,
nulls_last: bool = False,
multithreaded: bool = True,
in_place: bool = False,
) Self[source]#

对这个系列进行排序。

Parameters:
descending

按降序排序。

nulls_last

将空值放在最后而不是最前面。

multithreaded

使用多线程进行排序。

in_place

原地排序。

示例

>>> s = pl.Series("a", [1, 3, 4, 2])
>>> s.sort()
shape: (4,)
Series: 'a' [i64]
[
        1
        2
        3
        4
]
>>> s.sort(descending=True)
shape: (4,)
Series: 'a' [i64]
[
        4
        3
        2
        1
]