polars.Series.list.sort#

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

Sort the arrays in this column.

Parameters:
descending

Sort in descending order.

nulls_last

Place null values last.

multithreaded

Sort using multiple threads.

Examples

>>> 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]
]