Expr or Series Column of integer data type dtype
.
> df.lazy()
> .filter(pl.col("foo").lt(pl.intRange(0, 100)))
> .collect()
Generate an index column by using intRange
in conjunction with :func:len
.
df = pl.DataFrame({"a": [1, 3, 5], "b": [2, 4, 6]})
df.select(
... pl.intRange(pl.len()).alias("index"),
... pl.all(),
... )
shape: (3, 3)
┌───────┬─────┬─────┐
│ index ┆ a ┆ b │
│ --- ┆ --- ┆ --- │
│ u32 ┆ i64 ┆ i64 │
╞═══════╪═════╪═════╡
│ 0 ┆ 1 ┆ 2 │
│ 1 ┆ 3 ┆ 4 │
│ 2 ┆ 5 ┆ 6 │
└───────┴─────┴─────┘
Generate a range of integers.
This can be used in a
select
,with_column
etc. Be sure that the range size is equal to the DataFrame you are collecting.