Skip to content

Check if elements are finite

Source code

Description

Returns a boolean Series indicating which values are finite.

Usage

<Expr>$is_finite()

Value

Expr

Examples

library("polars")

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