Skip to content

Get maximum value with NaN

Source code

Description

Get maximum value, but returns NaN if there are any.

Usage

<Expr>$nan_max()

Value

Expr

Examples

library("polars")

pl$DataFrame(x = c(1, NA, 3, NaN, Inf))$
  with_columns(nan_max = pl$col("x")$nan_max())
#> shape: (5, 2)
#> ┌──────┬─────────┐
#> │ x    ┆ nan_max │
#> │ ---  ┆ ---     │
#> │ f64  ┆ f64     │
#> ╞══════╪═════════╡
#> │ 1.0  ┆ NaN     │
#> │ null ┆ NaN     │
#> │ 3.0  ┆ NaN     │
#> │ NaN  ┆ NaN     │
#> │ inf  ┆ NaN     │
#> └──────┴─────────┘