Skip to content

Commit

Permalink
Updated README to document --format and TSV, refs #4
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Feb 29, 2020
1 parent 4645d93 commit b9a25ca
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

Tool for viewing the difference between two CSV files. See [Generating a commit log for San Francisco’s official list of trees](https://simonwillison.net/2019/Mar/13/tree-history/) (and the [sf-tree-history repo commit log](https://github.com/simonw/sf-tree-history/commits)) for background information on this project.

## Installation

pip install csv-diff

## Usage

Consider two CSV files:

`one.csv`
Expand Down Expand Up @@ -43,7 +49,9 @@ Consider two CSV files:

The `--key=id` option means that the `id` column should be treated as the unique key, to identify which records have changed.

You can also run it using the `--json` option to get a machine-readable difference:
The tool will automatically detect if your files are comma- or tab-separated. You can over-ride this automatic detection and force the tool to use a specific format using `--format=tsv` or `--format=csv`.

You can use the `--json` option to get a machine-readable difference:

$ csv-diff one.csv two.csv --key=id --json
{
Expand Down Expand Up @@ -76,6 +84,8 @@ You can also run it using the `--json` option to get a machine-readable differen
"columns_removed": []
}

## As a Python library

You can also import the Python library into your own code like so:

from csv_diff import load_csv, compare
Expand Down

0 comments on commit b9a25ca

Please sign in to comment.