polars.arange#

polars.arange(low: int | polars.internals.expr.expr.Expr | polars.internals.series.series.Series, high: int | polars.internals.expr.expr.Expr | polars.internals.series.series.Series, step: int = 1, *, eager: Literal[False]) Expr[source]#
polars.arange(low: int | polars.internals.expr.expr.Expr | polars.internals.series.series.Series, high: int | polars.internals.expr.expr.Expr | polars.internals.series.series.Series, step: int = 1, *, eager: Literal[True], dtype: Optional[Union[Type[DataType], DataType]] = None) Series
polars.arange(low: int | polars.internals.expr.expr.Expr | polars.internals.series.series.Series, high: int | polars.internals.expr.expr.Expr | polars.internals.series.series.Series, step: int = 1, *, eager: bool = False, dtype: Optional[Union[Type[DataType], DataType]] = None) polars.internals.expr.expr.Expr | polars.internals.series.series.Series

Create a range expression (or Series).

This can be used in a select, with_column etc. Be sure that the resulting range size is equal to the length of the DataFrame you are collecting.

Parameters:
low

Lower bound of range.

high

Upper bound of range.

step

Step size of the range.

eager

If eager evaluation is True, a Series is returned instead of an Expr.

dtype

Apply an explicit integer dtype to the resulting expression (default is Int64).

Examples

>>> df.lazy().filter(pl.col("foo") < pl.arange(0, 100)).collect()