zip2fips // fip2zips
At work, we keep certain location information indexed by zipcode. Recently, I wanted to feed that data into something that worked with 5-digit FIPS county codes, and was unable to find an easily-parsed table that mapped, however roughly, from one to the other. The best I could find was the CDC's County Cross Reference files, but I realized I needed to do quite a bit of parsing before they were really useful to me. I figured it might be of use to someone else, so here it is.
The fetch_source script downloads the zip files and makes the one "cleanup" change required, to line 1794315 of zipcty4, which originally was missing GA as the state abbreviation.
makejson.py constructs the json dictionary from fips code to state, county and zip code from the zipcty files. The output is in fips2counties_v2.json.
The state_fips.json file was made by hand, where "by hand" means I copy-and-pasted this table and manipulated it in Emacs.