implode

May 31, 2026 · View on GitHub

Implode rows by grouping on key column(s) and joining a value column with a given separator. The inverse of explode.

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

Description | Examples | Usage | Implode Options | Common Options

Description

Implodes multiple rows into one by grouping on key column(s) and joining the values of another column with the given separator. The inverse of explode.

Examples

name,color
John,blue
John,yellow
John,light red
Mary,red

Can be imploded by key column "name", joining the "color" column with "; "

qsv implode -k name -v color "; " data.csv
name,color
John,blue; yellow; light red
Mary,red

With -r colors the value column is renamed

qsv implode -k name -v color -r colors "; " data.csv
name,colors
John,blue; yellow; light red
Mary,red

Only the key column(s) and the value column appear in the output; any other columns are dropped. By default, all input rows are buffered in memory and groups are emitted in the order keys are first seen. If the input is already sorted by the key column(s), use --sorted to stream groups as they are seen (memory proportional to the largest group, not the whole input). See also https://github.com/dathere/qsv/wiki/Transform-and-Reshape#implode

Usage

qsv implode [options] -k <keys> -v <value> <separator> [<input>]
qsv implode --help

Implode Options

     Option     TypeDescriptionDefault
 ‑k,
‑‑keys 
stringKey column(s) to group by. Supports the usual selector syntax (e.g. "name", "1", "1-3", "a,c"). (required)
 ‑v,
‑‑value 
stringThe column whose values will be joined per group. Must resolve to exactly one column. (required)
 ‑r,
‑‑rename 
stringNew name for the imploded value column.
 ‑‑sorted flagAssume input is pre-sorted by the key column(s). Streams groups as they are seen; memory is bounded by the size of the largest group.
 ‑‑skip‑empty flagSkip empty values when joining. By default, empty values are included as empty tokens so that round-tripping with explode is lossless.

Common Options

     Option     TypeDescriptionDefault
 ‑h,
‑‑help 
flagDisplay this message
 ‑o,
‑‑output 
stringWrite output to instead of stdout.
 ‑n,
‑‑no‑headers 
flagWhen set, the first row will not be interpreted as headers.
 ‑d,
‑‑delimiter 
stringThe field delimiter for reading CSV data. Must be a single character. (default: ,)

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