Expr.fill_null
methodView source ↗
def fill_null(
value: Any | TdExpr | None = None,
strategy: FillNullStrategy | None = None,
limit: int | None = None,
) -> TdExpr
Categories: manipulation
Replace null values with the given value.
Parameters
parameter
valueThe value to replace null values with.
parameter
strategyThe strategy to use for filling null values.
parameter
limitThe maximum number of null values to replace.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf = tf.select(td.col("val"), td.col("val")
>>> .fill_null(5.5).alias("fill_null"))
>>>
┌──────┬───────────┐
│ val ┆ fill_null │
│ --- ┆ --- │
│ f64 ┆ f64 │
╞══════╪═══════════╡
│ -1.0 ┆ -1.0 │
│ 0.0 ┆ 0.0 │
│ 1.1 ┆ 1.1 │
│ 2.0 ┆ 2.0 │
│ inf ┆ inf │
│ null ┆ 5.5 │
│ NaN ┆ NaN │
└──────┴───────────┘