tabsdata.tableframe.lazyframe.frame.TableFrame.fill_nan#

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

Replace all NaN values in the TableFrame with the given value.

Parameters:

value – The value to replace NaN with.

Example:

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
┌──────┬──────┐
│ x    ┆ y    │
│ ---  ┆ ---  │
│ f64  ┆ f64  │
╞══════╪══════╡
│ 1.0  ┆ 2.0  │
│ 2.0  ┆ 2.0  │
│ NaN  ┆ NaN  │
│ 4.0  ┆ NaN  │
│ 5.0  ┆ null │
│ null ┆ null │
└──────┴──────┘
>>>
>>> tf.fill_nan(10)
>>>
┌──────┬──────┐
│ x    ┆ y    │
│ ---  ┆ ---  │
│ f64  ┆ f64  │
╞══════╪══════╡
│ 1.0  ┆ 2.0  │
│ 2.0  ┆ 2.0  │
│ 10.0 ┆ 10.0 │
│ 4.0  ┆ 10.0 │
│ 5.0  ┆ null │
│ null ┆ null │
└──────┴──────┘