csvkit - Manipulate tabular data

csvkit is a suite of utilities for converting to and working with CSV, the king of tabular file formats. It includes commands to slice, search and join CSVs, and to extract information about the schema and a summary of the content.


Although CSVs are text files, typically organized by lines, they are not really suitable to be handled with standard UNIX command line tools, mainly because the tools have no notion of the organization by columns.

The following tools are available in csvkit:

  • csvclean: Fixes common errors in a CSV file.
  • csvcut: Filters and truncate CSV files. Like the Unix "cut" command, but for tabular data.
  • csvformat: Converts a CSV file to a custom output format, with selectable field separators, etc.
  • csvgrep: Searches CSV files. Like the Unix "grep" command, but for tabular data.
  • csvjoin: Executes a SQL-like join to merge CSV files on a specified column or columns.
  • csvjson: Converts a CSV file into JSON (or GeoJSON).
  • csvlook: Renders a CSV file in the console as a Markdown-compatible, fixed-width table.
  • csvpy: Loads a CSV file into a CSV reader and then drop into a Python shell.
  • csvsort: Sorts CSV files. Like the Unix "sort" command, but for tabular data.
  • csvsql: Generates SQL statements for one or more CSV files, or execute those statements directly on a database, and execute one or more SQL queries.
  • csvstack: Stacks up the rows from multiple CSV files, optionally adding a grouping value.
  • csvstat: Print descriptive statistics for each column in a CSV file.

References