Skip to main content

Find (fuzzy) matches between two CSV files in the terminal.

Project description

CSV Match
=========

Find (fuzzy) matches between two CSV files in the terminal.

Tested on Python 2.7 and 3.5.


Installing
----------

pip install csvmatch


Usage
-----

Say you have one CSV file such as:

```
name
George Smiley
Percy Alleline
Roy Bland
Toby Esterhase
Peter Guillam
Bill Haydon
Oliver Lacon
Jim Prideaux
Connie Sachs
```

And another such as:

```
name
Maria Andreyevna Ostrakova
Otto Leipzig
George Smiley
Peter Guillam
Connie Sachs
Saul Enderby
Sam Collins
Toby Esterhase
Claus Kretzschmar
```

You can then find the matches:

```bash
$ csvmatch data1.csv data2.csv

name,name
Peter Guillam,Peter Guillam
George Smiley,George Smiley
Toby Esterhase,Toby Esterhase
Connie Sachs,Connie Sachs
```

By default, all columns are used to compare rows. Specific columns can be also be given to be compared -- these should be in the same order for both files. Column headers with a space should be enclosed in quotes.

```bash
$ csvmatch dataA.csv dataB.csv \
--fields1 name address \
--fields2 'Person Name' Address \
> results.csv
```

(This example also uses output redirection to save the results to a file.)

Either file can also be piped in using `-` as a placeholder:

```bash
$ cat data1.csv | csvmatch - data2.csv
```

CSV Match also supports fuzzy matching. By default this makes use of the [Dedupe library] (https://github.com/datamade/dedupe) built by Forest Gregg and Derek Eder based on the work of Mikhail Bilenko. This algorithm asks you to give a number of examples of records from each dataset that are the same -- this information is extrapolated to link the rest of the dataset.

```bash
$ csvmatch dataX.csv dataY.csv --fuzzy
```

The more examples you give it, the better the results will be. At minimum, you should try to provide 10 positive matches and 10 negative matches.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csvmatch-1.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csvmatch-1.2-py2.py3-none-any.whl (6.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file csvmatch-1.2.tar.gz.

File metadata

  • Download URL: csvmatch-1.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for csvmatch-1.2.tar.gz
Algorithm Hash digest
SHA256 a1fe019997941a0461eefc99e7c7b2e3c409aca355240c9a2395af435bc0c53e
MD5 d04cd0b4720f1b32668908bfba104438
BLAKE2b-256 ad1a44a7b2701c3beaadd6b746167035cf2f7c63cf8d7a2bfe2c4f7017dcc62e

See more details on using hashes here.

File details

Details for the file csvmatch-1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for csvmatch-1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 eafd8f9f3cb9a8982cc901553d233f752bd18be4afb5a9d04b50ac6acb67f173
MD5 3be5f6120fe3a75df5bcb61565618b6a
BLAKE2b-256 4b1470f29f788cf47118a61aecf438b68730d138cb845abbf7bb9f0cab244d25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page