W3cubDocs

/Nushell

dfr sample for dataframe

Create sample dataframe.

Signature

> dfr sample {flags}

Flags

  • --n-rows, -n {int}: number of rows to be taken from dataframe
  • --fraction, -f {number}: fraction of dataframe to be taken
  • --seed, -s {number}: seed for the selection
  • --replace, -e: sample with replace
  • --shuffle, -u: shuffle sample

Input/output types:

input output
any any

Examples

Sample rows from dataframe

> [[ab]; [12] [34]] |dfr into-df|dfr sample-n1

Shows sample row using fraction and replace

> [[ab]; [12] [34] [56]] |dfr into-df|dfr sample-f0.5-e

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_sample.html