Function nth

  • Select nth column index in a DataFrame.

    Parameters

    • n: number

      Column index to select, starting at 0.

    Returns pl.Expr

    > df = pl.DataFrame({
    > "ham": [1, 2, 3],
    > "hamburger": [11, 22, 33],
    > "foo": [3, 2, 1]})
    > df.select(nth(2))
    shape: (3, 1)
    ╭─────╮
    foo
    │ --- │
    i64
    ╞═════╡
    3
    ├╌╌╌╌╌┤
    2
    ├╌╌╌╌╌┤
    1
    ╰─────╯