Join two tables by address

A customer list and the orders, two suppliers' files, last year's export and this year's: the same places in different words and no common ID. A text join misses most of them; a join on the house does not.

New Clean and compare Command line Retail, e-commerce

What you have

Two CSV files with an address column each; the column of the second is named with --b-column:

crm.csvfile
customer,address
C-17,"10 Rue de la Paix, Paris"
C-18,"55 rue du Faubourg Saint-Honoré, 75008 Paris"
C-19,"Paix, Lyon"
orders.csvfile
order,delivery_address
O-901,10 rue de la paix 75002 Paris
O-902,"10, Rue de la Paix, Paris"
O-903,"8 Rue de la Masure, 95150 Taverny"

Steps

1. Pair the rows that are one house, and keep the rows without a pair:

terminalCLI
$ gridpin match france.bin crm.csv orders.csv pairs.csv --b-column delivery_address --unmatched
A 3 rows, B 3 rows: 2 pairs at house; without a pair A 2 (no_pair 1, weak 1), B 1 (no_pair 1); 0.0 s

2. Read the pairs:

terminalCLI
$ cat pairs.csv

What you get

a_rowb_rowlevelreasona_addressb_address
11house10 Rue de la Paix, Paris10 rue de la paix 75002 Paris
12house10 Rue de la Paix, Paris10, Rue de la Paix, Paris
2no_pair55 rue du Faubourg Saint-Honoré, 75008 Paris
3weakPaix, Lyon
3no_pair8 Rue de la Masure, 95150 Taverny

Customer 1 has two orders: both pair at the house, though one has a postcode and the other an extra comma. Paix, Lyon is too vague to name a house and says weak instead of pairing on a guess.

Why it works

Every row is answered by the country file, and its key is the town, street and house number of the answer. The two files are joined on that key, so a pair of large files costs two geocoding runs, not a comparison of every row with every other.

Limits

  • In release 0.10.0 gridpin match works but is not yet listed by gridpin --help.
  • A house the file does not know cannot pair, even when both files write it the same way.
  • Flats in one building are one house.
  • --level street pairs by street instead, with every house of the street.

The function: join two tables by address. All its keys: command reference. Related: duplicates inside one list.