Skip to content

Get the minimum value rowwise

Source code

Description

Get the minimum value rowwise

Usage

pl$min_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$min_horizontal("a", "b", "c", 99.9)$alias("min")
)
#> shape: (4, 4)
#> ┌──────┬──────┬──────┬──────┐
#> │ a    ┆ b    ┆ c    ┆ min  │
#> │ ---  ┆ ---  ┆ ---  ┆ ---  │
#> │ f64  ┆ f64  ┆ f64  ┆ f64  │
#> ╞══════╪══════╪══════╪══════╡
#> │ null ┆ 2.0  ┆ 1.0  ┆ 1.0  │
#> │ null ┆ 1.0  ┆ 2.0  ┆ 1.0  │
#> │ null ┆ null ┆ null ┆ 99.9 │
#> │ null ┆ null ┆ -inf ┆ -inf │
#> └──────┴──────┴──────┴──────┘