W3cubDocs

/Nushell

dfr take for dataframe

Creates new dataframe using the given indices.

Signature

> dfr take {flags} (indices)

Parameters

  • indices: list of indices used to take data

Input/output types:

input output
any any

Examples

Takes selected rows from dataframe

>letdf= ([[ab]; [41] [52] [43]] |dfr into-df);
letindices= ([02] |dfr into-df);
$df|dfr take$indices
╭───┬───┬───╮
# │ a │ b │
├───┼───┼───┤
041
143
╰───┴───┴───╯

Takes selected rows from series

>letseries= ([415243] |dfr into-df);
letindices= ([02] |dfr into-df);
$series|dfr take$indices
╭───┬───╮
# │ 0 │
├───┼───┤
04
15
╰───┴───╯

Tips: Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe flag

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