Skip to main content
Version: 1.1.0

Expr.fill_null

def fill_null(
value: Any | Expr | None = None,
strategy: FillNullStrategy | None = None,
limit: int | None = None,
) -> Expr

Categories: manipulation

Replace null values with the given value.

Parameters

parameter
value

The value to replace null values with.

parameter
strategy

The strategy to use for filling null values.

parameter
limit

The 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.00.0
1.11.1
2.02.0
│ inf ┆ inf │
│ null ┆ 5.5
│ NaN ┆ NaN │
└──────┴───────────┘