Skip to content

Check if elements are infinite

Source code

Description

Returns a boolean Series indicating which values are infinite.

Usage

<Expr>$is_infinite()

Value

Expr

Examples

library("polars")

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