Expr.fill_nan
methodView source ↗
def fill_nan(value: int | float | TdExpr | None) -> TdExpr
Categories: manipulation
Replace NaN values with the given value.
Parameters
parameter
valueThe 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.1 ┆ 1.1 │
│ 2.0 ┆ 2.0 │
│ inf ┆ inf │
│ null ┆ null │
│ NaN ┆ 5.5 │
└──────┴──────────┘