Skip to content

Check if elements are infinite

Description

Check if elements are infinite

Usage

<Expr>$is_infinite()

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = c(1, 2), b = c(3, Inf))
df$with_columns(
  a_infinite = pl$col("a")$is_infinite(),
  b_infinite = pl$col("b")$is_infinite()
)
#> shape: (2, 4)
#> ┌─────┬─────┬────────────┬────────────┐
#> │ a   ┆ b   ┆ a_infinite ┆ b_infinite │
#> │ --- ┆ --- ┆ ---        ┆ ---        │
#> │ f64 ┆ f64 ┆ bool       ┆ bool       │
#> ╞═════╪═════╪════════════╪════════════╡
#> │ 1.0 ┆ 3.0 ┆ false      ┆ false      │
#> │ 2.0 ┆ inf ┆ false      ┆ true       │
#> └─────┴─────┴────────────┴────────────┘