1CSVSTAT(1) csvkit CSVSTAT(1)
2
3
4
6 csvstat - csvstat Documentation
7
9 Prints descriptive statistics for all columns in a CSV file. Will in‐
10 telligently determine the type of each column and then print analysis
11 relevant to that type (ranges for dates, mean and median for integers,
12 etc.):
13
14 usage: csvstat [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
15 [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-S] [-H]
16 [-K SKIP_LINES] [-v] [-l] [--zero] [-V] [--csv] [-n]
17 [-c COLUMNS] [--type] [--nulls] [--unique] [--min] [--max]
18 [--sum] [--mean] [--median] [--stdev] [--len] [--freq]
19 [--freq-count FREQ_COUNT] [--count] [-y SNIFF_LIMIT]
20 [FILE]
21
22 Print descriptive statistics for each column in a CSV file.
23
24 positional arguments:
25 FILE The CSV file to operate on. If omitted, will accept
26 input as piped data via STDIN.
27
28 optional arguments:
29 -h, --help show this help message and exit
30 --csv Output results as a CSV, rather than text.
31 -n, --names Display column names and indices from the input CSV
32 and exit.
33 -c COLUMNS, --columns COLUMNS
34 A comma-separated list of column indices, names or
35 ranges to be examined, e.g. "1,id,3-5". Defaults to
36 all columns.
37 --type Only output data type.
38 --nulls Only output whether columns contains nulls.
39 --unique Only output counts of unique values.
40 --min Only output smallest values.
41 --max Only output largest values.
42 --sum Only output sums.
43 --mean Only output means.
44 --median Only output medians.
45 --stdev Only output standard deviations.
46 --len Only output the length of the longest values.
47 --freq Only output lists of frequent values.
48 --freq-count FREQ_COUNT
49 The maximum number of frequent values to display.
50 --count Only output total row count.
51 -y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT
52 Limit CSV dialect sniffing to the specified number of
53 bytes. Specify "0" to disable sniffing.
54
55 See also: Arguments common to all tools.
56
58 Basic use:
59
60 csvstat examples/realdata/FY09_EDU_Recipients_by_State.csv
61
62 When an statistic name is passed, only that stat will be printed:
63
64 csvstat --min examples/realdata/FY09_EDU_Recipients_by_State.csv
65
66 1. State Name: None
67 2. State Abbreviate: None
68 3. Code: 1
69 4. Montgomery GI Bill-Active Duty: 435
70 5. Montgomery GI Bill- Selective Reserve: 48
71 6. Dependents' Educational Assistance: 118
72 7. Reserve Educational Assistance Program: 60
73 8. Post-Vietnam Era Veteran's Educational Assistance Program: 1
74 9. TOTAL: 768
75 10. j: None
76
77 If a single stat and a single column are requested, only a value will
78 be returned:
79
80 csvstat -c 4 --mean examples/realdata/FY09_EDU_Recipients_by_State.csv
81
82 6,263.904
83
85 Christopher Groskopf
86
88 2022, Christopher Groskopf
89
90
91
92
931.0.7 Jul 22, 2022 CSVSTAT(1)