Fill floating point NaN
value with a fill value
Description
Fill floating point NaN
value with a fill value
Usage
<Expr>$fill_nan(value)
Arguments
value
|
Value used to fill NaN values.
|
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(a = c(1, NA, 2, NaN))
df$with_columns(
filled_nan = pl$col("a")$fill_nan(99)
)
#> shape: (4, 2)
#> ┌──────┬────────────┐
#> │ a ┆ filled_nan │
#> │ --- ┆ --- │
#> │ f64 ┆ f64 │
#> ╞══════╪════════════╡
#> │ 1.0 ┆ 1.0 │
#> │ null ┆ null │
#> │ 2.0 ┆ 2.0 │
#> │ NaN ┆ 99.0 │
#> └──────┴────────────┘