Fill NaN
Description
Fill NaN
Usage
<Expr>$fill_nan(expr = NULL)
Arguments
expr
|
Expr or something coercible in an Expr |
Value
Expr
Examples
library(polars)
pl$DataFrame(a = c(NaN, 1, NaN, 2, NA))$
with_columns(
literal = pl$col("a")$fill_nan(999),
# implicit coercion to string
string = pl$col("a")$fill_nan("invalid")
)
#> shape: (5, 3)
#> ┌──────┬─────────┬─────────┐
#> │ a ┆ literal ┆ string │
#> │ --- ┆ --- ┆ --- │
#> │ f64 ┆ f64 ┆ str │
#> ╞══════╪═════════╪═════════╡
#> │ NaN ┆ 999.0 ┆ invalid │
#> │ 1.0 ┆ 1.0 ┆ 1.0 │
#> │ NaN ┆ 999.0 ┆ invalid │
#> │ 2.0 ┆ 2.0 ┆ 2.0 │
#> │ null ┆ null ┆ null │
#> └──────┴─────────┴─────────┘