Sort values in every sub-list
Description
Sort values in every sub-list
Usage
<Expr>$list$sort(..., descending = FALSE, nulls_last = FALSE)
Arguments
…
|
These dots are for future extensions and must be empty. |
descending
|
Sort values in descending order. |
nulls_last
|
Place null values last. |
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(values = list(c(NA, 2, 1, 3), c(Inf, 2, 3, NaN), NA))
df$with_columns(sort = pl$col("values")$list$sort())
#> shape: (3, 2)
#> ┌────────────────────┬────────────────────┐
#> │ values ┆ sort │
#> │ --- ┆ --- │
#> │ list[f64] ┆ list[f64] │
#> ╞════════════════════╪════════════════════╡
#> │ [null, 2.0, … 3.0] ┆ [null, 1.0, … 3.0] │
#> │ [inf, 2.0, … NaN] ┆ [2.0, 3.0, … NaN] │
#> │ [null] ┆ [null] │
#> └────────────────────┴────────────────────┘