polars.arange#
- polars.arange(low: int | Expr | Series, high: int | Expr | Series, step: int = 1, *, eager: Literal[False]) Expr [source]#
- polars.arange(low: int | Expr | Series, high: int | Expr | Series, step: int = 1, *, eager: Literal[True], dtype: PolarsDataType | None = None) Series
- polars.arange(low: int | Expr | Series, high: int | Expr | Series, step: int = 1, *, eager: bool = False, dtype: PolarsDataType | None = None) Expr | 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
Evaluate immediately and return a
Series
. If set toFalse
(default), return an expression instead.- 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()