polars.zeros#

polars.zeros(
n: int | Expr,
dtype: PolarsDataType = Float64,
*,
eager: bool = False,
) Expr | Series[source]#

Construct a column of length n filled with zeros.

This is syntactic sugar for the repeat function.

Parameters:
n

Length of the resulting column.

dtype

Data type of the resulting column. Defaults to Float64.

eager

Evaluate immediately and return a Series. If set to False, return an expression instead.

See also

repeat
lit

Notes

If you want to construct a column in lazy mode and do not need a pre-determined length, use lit() instead.

Examples

>>> pl.zeros(3, pl.Int8, eager=True)
shape: (3,)
Series: 'zeros' [i8]
[
    0
    0
    0
]