Skip to content

Compute the max value of the sub-arrays

Description

Compute the max value of the sub-arrays

Usage

<Expr>$arr$max()

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(
  values = list(c(1, 2), c(3, 4), c(NA, NA))
)$cast(pl$Array(pl$Float64, 2))
df$with_columns(max = pl$col("values")$arr$max())
#> shape: (3, 2)
#> ┌───────────────┬──────┐
#> │ values        ┆ max  │
#> │ ---           ┆ ---  │
#> │ array[f64, 2] ┆ f64  │
#> ╞═══════════════╪══════╡
#> │ [1.0, 2.0]    ┆ 2.0  │
#> │ [3.0, 4.0]    ┆ 4.0  │
#> │ [null, null]  ┆ null │
#> └───────────────┴──────┘