Skip to main content

pandas-usaddress

The usaddress library made easy with Pandas.

Also supports standardizing addresses to meet USPS standards.

Installation

pip install pandas-usaddress

Usage

Basic Parsing

import pandas as pd
import pandas_usaddress

#load dataframe
df = pd.read_csv('test_file.csv')

#initiate usaddress
df = pandas_usaddress.tag(df, ['address_field'])

#send output to csv
df.to_csv('parsed_output.csv')


#------------------------------additional details------------------------------

#Output and fields will be identical to usaddress

Parsing with Address Standardization

import pandas as pd
import pandas_usaddress

#load dataframe
df = pd.read_csv('test_file.csv')

#initiate usaddress
df = pandas_usaddress.tag(df, ['address_field'], granularity='medium', standardize=True)

#send output to csv
df.to_csv('parsed_output.csv')


#------------------------------additional details------------------------------

#The standard output for usaddress has a lot of fields. The granularity parameter
#allows you to condense the results you get back for different types of analysis.
#see parameter documentation below for all granularity options.

#Addresses are often unstandardized. The same address can come as 123 1st ST, or
#123 First Street, etc. This can cause issues with analysis such as aggregation,
#or record matching. The standardize parameter attempts to standardize the address
#to US Postal Service (USPS) standards.

Parsing with Address Standardization

import pandas as pd
import pandas_usaddress

#load dataframe
df = pd.read_csv('test_file.csv')

#initiate usaddress
df = pandas_usaddress.tag(df, ['street1', 'street2', 'city', 'state'], granularity='single', standardize=True)

#send output to csv
df.to_csv('parsed_output.csv')


#------------------------------additional details------------------------------

#You can also use pandas-usaddress to concatenate and parse multiple address lines. 
#This can be helpful when you are working with two datasets that have different 
#field names and you want the field names to be standardized using a specific level of
#granularity. It's pretty common for instance that in one dataset will concatenate 
#address line 1 and 2, and another will not.

#You will help the parser do it's job if you try to concatenate fields in approximately
#same order that you would write them on an envelope.

#In this instance, we are taking multiple address fields and converting them into a
#single address line. That's fine to do!

Metadata

Release files for pandas-usaddress 0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pandas-usaddress 0.11
File Size Uploaded
pandas_usaddress-0.11.tar.gz 298.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pandas-usaddress 0.11
File Interpreter ABI Platform
pandas_usaddress-0.11-py3-none-any.whl Python 3 none any Details

Total release size: 619.2 kB

Release files / pandas_usaddress-0.11.tar.gz

Download URL pandas_usaddress-0.11.tar.gz
Size 298.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fc254acbef85a1b4638c6f7ee29213e654c996e341ee99e03516af776f08c9f4
BLAKE2b-256 checksum
How to use checksums
57244bc5df586da390946d4fca9c9492ee7a95d553a69f9e948c62657a1298f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.5

Release files / pandas_usaddress-0.11-py3-none-any.whl

Download URL pandas_usaddress-0.11-py3-none-any.whl
Size 320.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67551237788061e51ab7c2484095eda2f996e30dbf3a72fb78bf9aab589f9002
BLAKE2b-256 checksum
How to use checksums
3a1d7f7ff0dbe571828cf6cf8a5158f0310a22df1a9a8f6e3884598b1d8e41f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.5

Release history Release notifications | RSS feed

0.21

2 release files

This release

0.11 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page