Skip to content

Latest commit

 

History

History
80 lines (56 loc) · 3.28 KB

File metadata and controls

80 lines (56 loc) · 3.28 KB

fill

Fill empty values.

Table of Contents | Source: src/cmd/fill.rs | 👆

Description | Usage | Fill Options | Common Options

Description

Fill empty fields in selected columns of a CSV.

This command fills empty fields in the selected column using the last seen non-empty field in the CSV. This is useful to forward-fill values which may only be included the first time they are encountered.

The option --default <value> fills all empty values in the selected columns with the provided default value.

The option --first fills empty values using the first seen non-empty value in that column, instead of the most recent non-empty value in that column.

The option --backfill fills empty values at the start of the CSV with the first valid value in that column. This requires buffering rows with empty values in the target column which appear before the first valid value.

The option --groupby groups the rows by the specified columns before filling in the empty values. Using this option, empty values are only filled with values which belong to the same group of rows, as determined by the columns selected in the --groupby option.

When both --groupby and --backfill are specified, and the CSV is not sorted by the --groupby columns, rows may be re-ordered during output due to the buffering of rows collected before the first valid value.

For examples, see https://github.com/dathere/qsv/blob/master/tests/test_fill.rs.

Usage

qsv fill [options] [--] <selection> [<input>]
qsv fill --help

Fill Options

     Option      Type Description Default
 ‑g,
‑‑groupby 
string Group by specified columns.
 ‑f,
‑‑first 
flag Fill using the first valid value of a column, instead of the latest.
 ‑b,
‑‑backfill 
flag Fill initial empty values with the first valid value.
 ‑v,
‑‑default 
string Fill using this default value.

Common Options

     Option      Type Description Default
 ‑h,
‑‑help 
flag Display this message
 ‑o,
‑‑output 
string Write output to instead of stdout.
 ‑n,
‑‑no‑headers 
flag When set, the first row will not be interpreted as headers. (i.e., They are not searched, analyzed, sliced, etc.)
 ‑d,
‑‑delimiter 
string The field delimiter for reading CSV data. Must be a single character. (default: ,)

Source: src/cmd/fill.rs | Table of Contents | README