1CSVSTACK(1) csvkit CSVSTACK(1)
2
3
4
6 csvstack - csvstack Documentation
7
9 Stack up the rows from multiple CSV files, optionally adding a grouping
10 value to each row:
11
12 usage: csvstack [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
13 [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-S] [-H]
14 [-K SKIP_LINES] [-v] [-l] [--zero] [-V] [-g GROUPS]
15 [-n GROUP_NAME] [--filenames]
16 FILE [FILE ...]
17
18 Stack up the rows from multiple CSV files, optionally adding a grouping value.
19
20 positional arguments:
21 FILE The CSV file(s) to operate on. If omitted, will accept
22 input as piped data via STDIN.
23
24 optional arguments:
25 -h, --help show this help message and exit
26 -g GROUPS, --groups GROUPS
27 A comma-separated list of values to add as "grouping
28 factors", one for each CSV being stacked. These are
29 added to the output as a new column. You may specify a
30 name for the new column using the -n flag.
31 -n GROUP_NAME, --group-name GROUP_NAME
32 A name for the grouping column, e.g. "year". Only used
33 when also specifying -g.
34 --filenames Use the filename of each input file as its grouping
35 value. When specified, -g will be ignored.
36
37 See also: Arguments common to all tools.
38
40 Joining a set of files for different years:
41
42 csvstack -g 2009,2010 examples/realdata/FY09_EDU_Recipients_by_State.csv examples/realdata/Datagov_FY10_EDU_recp_by_State.csv
43
44 Add a single column to the left of a CSV:
45
46 csvstack -n NEWCOL -g "" examples/dummy.csv
47
49 Christopher Groskopf
50
52 2023, Christopher Groskopf
53
54
55
56
571.1.1 Jul 21, 2023 CSVSTACK(1)