Get the maximum value rowwise
Description
Get the maximum value rowwise
Usage
pl$max_horizontal(...)
Arguments
…
|
Columns to concatenate into a single string column. Accepts expressions. Strings are parsed as column names, other non-expression inputs are parsed as literals. |
Value
Expr
Examples
library("polars")
df = pl$DataFrame(
a = NA_real_,
b = c(2:1, NA_real_, NA_real_),
c = c(1:2, NA_real_, Inf)
)
df$with_columns(
pl$max_horizontal("a", "b", "c", 99.9)$alias("max")
)
#> shape: (4, 4)
#> ┌──────┬──────┬──────┬──────┐
#> │ a ┆ b ┆ c ┆ max │
#> │ --- ┆ --- ┆ --- ┆ --- │
#> │ f64 ┆ f64 ┆ f64 ┆ f64 │
#> ╞══════╪══════╪══════╪══════╡
#> │ null ┆ 2.0 ┆ 1.0 ┆ 99.9 │
#> │ null ┆ 1.0 ┆ 2.0 ┆ 99.9 │
#> │ null ┆ null ┆ null ┆ 99.9 │
#> │ null ┆ null ┆ inf ┆ inf │
#> └──────┴──────┴──────┴──────┘