Skip to content

Check if elements are not NaN

Source code

Description

Returns a boolean Series indicating which values are not NaN. Syntactic sugar for $is_nan()$not().

Usage

<Expr>$is_not_nan()

Value

Expr

Examples

library("polars")

pl$DataFrame(list(alice = c(0, NaN, NA, Inf, -Inf)))$
  with_columns(not_nan = pl$col("alice")$is_not_nan())
#> shape: (5, 2)
#> ┌───────┬─────────┐
#> │ alice ┆ not_nan │
#> │ ---   ┆ ---     │
#> │ f64   ┆ bool    │
#> ╞═══════╪═════════╡
#> │ 0.0   ┆ true    │
#> │ NaN   ┆ false   │
#> │ null  ┆ null    │
#> │ inf   ┆ true    │
#> │ -inf  ┆ true    │
#> └───────┴─────────┘