tabsdata.tableframe.expr.expr.Expr.fill_nan#

Expr.fill_nan(value: int | float | Expr | None) Expr[source]#

Replace NaN values with the given value.

Parameters:

value – The value to replace NaN values with.

Example:

>>> 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.1  ┆ 1.1      │
│ 2.0  ┆ 2.0      │
│ inf  ┆ inf      │
│ null ┆ null     │
│ NaN  ┆ 5.5      │
└──────┴──────────┘