pandas

Merge big CSV files with Pandas and Python

I deal with large CSV at work, mostly database dumps. Google Sheets and Numbers/Excel just can't keep up with formula changes for 300k+ lines. What do we do? We use Python.

The use case here is replicating a the VLOOKUP function with a left join. We want to get the matching criteria from our referenced CSV file, but only the matching (otherwise that would be a full outer join).

Here's what our data looks like:

We want to look up the lat/long in our reference file and join on zip code. Here's what that data looks like:

Note the matching "zip" column names.

Here's the code:

Tags