NAME
csvstat - csvstat Documentation
DESCRIPTION
Prints descriptive statistics for all columns in a CSV file. Will intelligently determine the type of each column and then print analysis relevant to that type (ranges for dates, mean and median for integers, etc.):
usage: csvstat [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b][-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-L LOCALE][-S] [--blanks] [--null-value NULL_VALUES [NULL_VALUES ...]][--date-format DATE_FORMAT] [--datetime-format DATETIME_FORMAT][-H] [-K SKIP_LINES] [-v] [-l] [--zero] [-V] [--csv] [--json][-i INDENT] [-n] [-c COLUMNS] [--type] [--nulls] [--non-nulls][--unique] [--min] [--max] [--sum] [--mean] [--median][--stdev] [--len] [--max-precision] [--freq][--freq-count FREQ_COUNT] [--count][--decimal-format DECIMAL_FORMAT] [-G] [-y SNIFF_LIMIT] [-I][FILE]Print descriptive statistics for each column in a CSV file.positional arguments:FILE The CSV file to operate on. If omitted, will acceptinput as piped data via STDIN.optional arguments:-h, --help show this help message and exit--csv Output results as a CSV table, rather than plain text.--json Output results as JSON text, rather than plain text.-i INDENT, --indent INDENTIndent the output JSON this many spaces. Disabled bydefault.-n, --names Display column names and indices from the input CSVand exit.-c COLUMNS, --columns COLUMNSA comma-separated list of column indices, names orranges to be examined, e.g. "1,id,3-5". Defaults toall columns.--type Only output data type.--nulls Only output whether columns contains nulls.--non-nulls Only output counts of non-null values.--unique Only output counts of unique values.--min Only output smallest values.--max Only output largest values.--sum Only output sums.--mean Only output means.--median Only output medians.--stdev Only output standard deviations.--len Only output the length of the longest values.--max-precision Only output the most decimal places.--freq Only output lists of frequent values.--freq-count FREQ_COUNTThe maximum number of frequent values to display.--count Only output total row count.--decimal-format DECIMAL_FORMAT%-format specification for printing decimal numbers.Defaults to locale-specific formatting with "%.3f".-G, --no-grouping-separatorDo not use grouping separators in decimal numbers.-y SNIFF_LIMIT, --snifflimit SNIFF_LIMITLimit CSV dialect sniffing to the specified number ofbytes. Specify "0" to disable sniffing entirely, or"-1" to sniff the entire file.-I, --no-inference Disable type inference (and --locale, --date-format,--datetime-format, --no-leading-zeroes) when parsingthe input.
See also: Arguments common to all tools.
EXAMPLES
Basic use:
csvstat examples/realdata/FY09_EDU_Recipients_by_State.csv
When an statistic name is passed, only that stat will be printed:
$ csvstat --min examples/realdata/FY09_EDU_Recipients_by_State.csv1. State Name: None2. State Abbreviate: None3. Code: 14. Montgomery GI Bill-Active Duty: 4355. Montgomery GI Bill- Selective Reserve: 486. Dependents' Educational Assistance: 1187. Reserve Educational Assistance Program: 608. Post-Vietnam Era Veteran's Educational Assistance Program: 19. TOTAL: 76810. j: None
If a single stat and a single column are requested, only a value will be returned:
$ csvstat -c 4 --mean examples/realdata/FY09_EDU_Recipients_by_State.csv6,263.904
AUTHOR
Christopher Groskopf and contributors
COPYRIGHT
2016, Christopher Groskopf and James McKinney