polars.Series.list.sort#

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

对此列中的数组进行排序。

Parameters:
descending

按降序排序。

nulls_last

将空值放在最后。

multithreaded

使用多线程进行排序。

示例

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