Is there a library for parsing US addresses?
Pyparsing
has a bunch of functionality for parsing street addresses, check out an example for this here: http://pyparsing.wikispaces.com/file/view/streetAddressParser.py
Quite a few of these answers are a few years old now.
The most bulletproof library I've seen recently is usaddress
: https://github.com/datamade/usaddress:
- Far more accurate than
address
which we'd been using for a year now https://pypi.python.org/pypi/address/0.1.1. - Yet to see it fail on an address
- Still being committed to as of this writing
Pro tip: when testing addresses in all these libraries, use 1) no commas in your address, 2) multi-word city names preferably with "St." in the name to see if the library can differentiate between "street" and "Saint" (e.g., St. Louis), and 3) improper casing. This combo will typically make even the better parsers fall down.