Skip to content

Fill floating point NaN value with a fill value

Source code

Description

Fill floating point NaN value with a fill value

Usage

<LazyFrame>$fill_nan(value)

Arguments

value Value used to fill NaN values.

Value

LazyFrame

Examples

library("polars")

df = pl$LazyFrame(
  a = c(1.5, 2, NaN, 4),
  b = c(1.5, NaN, NaN, 4)
)
df$fill_nan(99)$collect()
#> shape: (4, 2)
#> ┌──────┬──────┐
#> │ a    ┆ b    │
#> │ ---  ┆ ---  │
#> │ f64  ┆ f64  │
#> ╞══════╪══════╡
#> │ 1.5  ┆ 1.5  │
#> │ 2.0  ┆ 99.0 │
#> │ 99.0 ┆ 99.0 │
#> │ 4.0  ┆ 4.0  │
#> └──────┴──────┘