Skip to main content
Version: 1.4.0

Expr.fill_nan

def fill_nan(value: int | float | Expr | None) -> Expr

Categories: manipulation

Replace NaN values with the given value.

Parameters

parameter
value

The value to replace NaN values with.

Examples

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf = tf.select(td.col("val"), td.col("val").fill_nan(5.5)
>>> .alias("fill_nan"))
>>>
┌──────┬──────────┐
│ val ┆ fill_nan │
------
│ f64 ┆ f64 │
╞══════╪══════════╡
1.11.1
2.02.0
│ inf ┆ inf │
│ null ┆ null │
│ NaN ┆ 5.5
└──────┴──────────┘