Spec-Zone.ru › Nushell

polars take for dataframe

Creates new dataframe using the given indices.

Signature

> polars take {flags} (indices)

Parameters

  • indices: List of indices used to take data.

Input/output types:

input output
polars_dataframe polars_dataframe
polars_lazyframe polars_lazyframe

Examples

Takes selected rows from dataframe

> let df = ([[a b]; [4 1] [5 2] [4 3]] | polars into-df);
    let indices = ([0 2] | polars into-df);
    $df | polars take $indices
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 0 │ 4 │ 1 │
│ 1 │ 4 │ 3 │
╰───┴───┴───╯

Takes selected rows from series

> let series = ([4 1 5 2 4 3] | polars into-df);
    let indices = ([0 2] | polars into-df);
    $series | polars take $indices
╭───┬───╮
│ # │ 0 │
├───┼───┤
│ 0 │ 4 │
│ 1 │ 5 │
╰───┴───╯

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/polars_take.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API