polars.int_range#

polars.int_range(
start: int | IntoExpr,
end: int | IntoExpr,
step: int = 1,
*,
dtype: PolarsIntegerType = Int64,
eager: Literal[False] = False,
) Expr[source]#
polars.int_range(
start: int | IntoExpr,
end: int | IntoExpr,
step: int = 1,
*,
dtype: PolarsIntegerType = Int64,
eager: Literal[True],
) Series
polars.int_range(
start: int | IntoExpr,
end: int | IntoExpr,
step: int = 1,
*,
dtype: PolarsIntegerType = Int64,
eager: bool,
) Expr | Series

Generate a range of integers.

Parameters:
start

Lower bound of the range (inclusive).

end

Upper bound of the range (exclusive).

step

Step size of the range.

dtype

Data type of the range. Defaults to Int64.

eager

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

Returns:
Expr or Series

Column of data type Int64.

See also

int_ranges

Generate a range of integers for each row of the input columns.

Examples

>>> pl.int_range(0, 3, eager=True)
shape: (3,)
Series: 'int' [i64]
[
        0
        1
        2
]