polars.Series.arr.sort#

Series.arr.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]], dtype=pl.Array(pl.Int64, 3))
>>> s.arr.sort()
shape: (2,)
Series: 'a' [array[i64, 3]]
[
    [1, 2, 3]
    [1, 2, 9]
]
>>> s.arr.sort(descending=True)
shape: (2,)
Series: 'a' [array[i64, 3]]
[
    [3, 2, 1]
    [9, 2, 1]
]