Beta · version 0.7.4 · commands and the JSON format may still change.
Random sample
random selects rows uniformly from the entire file. The sample approximately
keeps the proportions of the file.
tabalyst sample customers.csv --sample-method random --percent 5 --seed 42Key points
Section titled “Key points”- Seed: add
--seedwhen another run must select the same rows. - Size:
--rowsor--percent, exactly one. - Cost: one reading of the file, and only the requested rows are stored in memory.
- Output:
customers.sample.csvbeside the source, in file order.
Limits
Section titled “Limits”- A rare value can be missed: a value that appears once in a million rows is unlikely to be drawn. Use a smart sample to keep every value of the small columns and the odd cases.
- To keep the proportions of one field, or of a few, use a stratified sample.
--field,--max-strata,--yesand--no-htmlare errors with this method (exit code 2).
See Tabalyst Sample for sizes, output locations and CSV formats.