polars.Series.sort

Series.sort(reverse: bool = False, *, in_place: Literal[False] = False) polars.internals.series.Series
Series.sort(reverse: bool = False, *, in_place: Literal[True]) None
Series.sort(reverse: bool = False, *, in_place: bool = 'False') Optional[polars.internals.series.Series]

Sort this Series.

Parameters
reverse

Reverse sort.

in_place

Sort in place.

Examples

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