Function intRange

  • 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.

    Parameters

    • opts: {
          dtype?: DataType;
          eager?: boolean;
          end: number | pl.Expr;
          start: number | pl.Expr;
          step?: number | pl.Expr;
      }

    Returns any

    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)
    ┌───────┬─────┬─────┐
    indexab
    │ --- ┆ --- ┆ --- │
    u32i64i64
    ╞═══════╪═════╪═════╡
    012
    134
    256
    └───────┴─────┴─────┘
  • Parameters

    • opts: {
          dtype?: DataType;
          eager?: boolean;
          high: number | pl.Expr;
          low: number | pl.Expr;
          step?: number | pl.Expr;
      }

    Returns any

    since 0.15.0 use start and end instead

  • Parameters

    Returns pl.Series

  • Parameters

    Returns pl.Expr