Find the maximum value in an array
Description
Find the maximum value in an array
Usage
<Expr>$arr$max()
Details
This method is only available with the "nightly" feature. See
polars_info()
for more details.
Value
Expr
Examples
library("polars")
df = pl$DataFrame(
values = list(c(1, 2), c(3, 4), c(NA_real_, NA_real_)),
schema = list(values = 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 │
#> └───────────────┴──────┘