Skip to content

LazyColumn.fillna

fillna

fillna(value: Any) -> LazyColumn

Replaces null (NA) values in this column with a specified value.

Parameters:

Name Type Description Default
value Any

The value to use for filling null values. Can be a number, string, or any valid DuckDB expression.

required

Returns:

Name Type Description
LazyColumn LazyColumn

A new LazyColumn where all null values have been replaced by the specified value.

Examples:

print(df.head())
#    col1  my_column_to_test
# 0     1               10.0
# 1     2               None
# 2     3                7.5
# 3     4               None
# 4     5               12.0

# Filling null values with 0
df["my_column_to_test"].fillna(0)
# [10.0, 0, 7.5, 0, 12.0]