polars.zeros#

polars.zeros(n: int, dtype: PolarsDataType | None = None) Series[source]#

Return a new Series of given length and type, filled with zeros.

Parameters:
n

Number of elements in the Series

dtype

DataType of the elements, defaults to polars.Float64

Notes

In the lazy API you should probably not use this, but use lit(0) instead.

Examples

>>> pl.zeros(5, pl.Int64)
shape: (5,)
Series: '' [i64]
[
    0
    0
    0
    0
    0
]