TableFrame.fill_nan
methodView source ↗
def fill_nan(value: int | float | TdExpr | None) -> TdLazyFrame
Categories: manipulation
Replace all NaN values in the TableFrame with the given value.
Parameters
parameter
valueThe value to replace NaN with.
Examples
>>> 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 │
└──────┴──────┘