ert_frame_equal.html)
    * [ polars.testing.assert_frame_not_equal ](../../api/polars.testing.assert_frame_not_equal.html)
    * [ polars.testing.assert_series_equal ](../../api/polars.testing.assert_series_equal.html)
    * [ polars.testing.assert_series_not_equal ](../../api/polars.testing.assert_series_not_equal.html)
    * [ polars.testing.parametric.dataframes ](../../api/polars.testing.parametric.dataframes.html)
    * [ polars.testing.parametric.series ](../../api/polars.testing.parametric.series.html)
    * [ polars.testing.parametric.column ](../../api/polars.testing.parametric.column.html)
    * [ polars.testing.parametric.columns ](../../api/polars.testing.parametric.columns.html)
    * [ polars.testing.parametric.create_list_strategy ](../../api/polars.testing.parametric.create_list_strategy.html)
    * [ polars.testing.parametric.load_profile ](../../api/polars.testing.parametric.load_profile.html)
    * [ polars.testing.parametric.set_profile ](../../api/polars.testing.parametric.set_profile.html)

  * [ Metadata ](../../metadata.html) __
    * [ polars.build_info ](../../api/polars.build_info.html)
    * [ polars.get_index_type ](../../api/polars.get_index_type.html)
    * [ polars.show_versions ](../../api/polars.show_versions.html)
    * [ polars.thread_pool_size ](../../api/polars.thread_pool_size.html)
    * [ polars.threadpool_size ](../../api/polars.threadpool_size.html)

  * [ __ ](../../../index.html)
  * [ Python API reference ](../../index.html)
  * __
  * [ Array ](../array.html)
  * polars.Expr.arr.sort 

#  polars.Expr.arr.sort  #

Expr.arr.  sort  (  _ *  _ , _ descending  :  [ bool
](https://docs.python.org/3/library/functions.html#bool "\(in Python v3.12\)")
=  False  _ , _ nulls_last  :  [ bool
](https://docs.python.org/3/library/functions.html#bool "\(in Python v3.12\)")
=  False  _ )  →  Expr  [ [source]  ](https://github.com/pola-
rs/polars/blob/main/py-polars/polars/expr/array.py#L311-L352) #

    

Sort the arrays in this column.

Parameters  :

    

**descending**

    

Sort in descending order.

**nulls_last**

    

Place null values last.

Examples

    
    
    >>> df = pl.DataFrame(
    ...     {
    ...         "a": [[3, 2, 1], [9, 1, 2]],
    ...     },
    ...     schema={"a": pl.Array(pl.Int64, 3)},
    ... )
    >>> df.with_columns(sort=pl.col("a").arr.sort())
    shape: (2, 2)
    ┌───────────────┬───────────────┐
    │ a             ┆ sort          │
    │ ---           ┆ ---           │
    │ array[i64, 3] ┆ array[i64, 3] │
    ╞═══════════════╪═══════════════╡
    │ [3, 2, 1]     ┆ [1, 2, 3]     │
    │ [9, 1, 2]     ┆ [1, 2, 9]     │
    └───────────────┴───────────────┘
    >>> df.with_columns(sort=pl.col("a").arr.sort(descending=True))
    shape: (2, 2)
    ┌───────────────┬───────────────┐
    │ a             ┆ sort          │
    │ ---           ┆ ---           │
    │ array[i64, 3] ┆ array[i64, 3] │
    ╞═══════════════╪═══════════════╡
    │ [3, 2, 1]     ┆ [3, 2, 1]     │
    │ [9, 1, 2]     ┆ [9, 2, 1]     │
    └───────────────┴───────────────┘
    

[ __ previous  polars.Expr.arr.any  ](polars.Expr.arr.any.html "previous
page") [ next  polars.Expr.arr.reverse  __ ](polars.Expr.arr.reverse.html
"next page")

__ On this page

  * ` Expr.arr.sort()  `

© Copyright 2020, Ritchie Vink.  

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.4.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.1.