Skip to main content

Address Toolkit

Python License

Introduction

The address toolkit package supports the cleaning and processing of address data registered as a pyspark.sql.DataFrame. The package includes functions for cleaning, validating, extracting and contextualising addresses and address components. Additionally, workflows have been created as an 'out-of-the-box' application combining the functions across cleaning, validating and extracting.

To install the package, run:

pip install address-toolkit

To register a spark dataframe from a CSV, the following code can be run.

from pyspark.sql import SparkSession


spark = SparkSession.builder.master("local").appName("test").getOrCreate()
df = spark.read.csv("test.csv")

A recommended first step in using this package is to apply the clean_punctuation function from address_toolkit.cleaning.

from address_toolkit.cleaning import clean_punctuation

df = clean_punctuation(df, 'address_column', create_flag = True, overwrite = True)

Main Package Contents:

Folder Name Description Includes
cleaning Contains functions to clean addresses clean_punctuation, denoise_addresses, deduplicate_addresses, deduplicate_postcodes, rectify_postcodes, standardise_street_types, prettify_addresses
validating Contains functions to validate addresses validate_from_list, validate_from_regex, validate_postcodes
extracting Contains functions to extract address components extract_from_list, extract_from_regex, extract_postcodes
contextualising Contains functions to contextualise addresses contextualise_from_lookup
workflows Contains functions to streamline processing clean_addresses, validate_addresses, extract_address_components

Supplementary Package Contents (Resources):

Resource Includes
UK Postcode Regex postcode_regex
Unit Address Level Regex flat_regex, room_regex, unit_regex, block_regex, apartment_regex, floor_regex
Noise Regex consecutive_letters_regex
Miscellaneous Regex misc_numbers_regex, standalone_numbers_regex, txt_before_numbers_regex, end_address_numbers_regex, start_address_numbers_regex, end_address_identifier_regex
Address Component Lists town_list, city_list, village_list, hamlet_list, suburb_list, bay_list, place_list, district_list, county_list, allowed_country_list, disallowed_country_list
Keyword Component Lists contextual_keywords, misc_keywords_list, misc_special_keywords
Address Component Lookups town_lookup, village_lookup, bay_lookup, hamlet_lookup, suburb_lookup

Note: For unit address level RegEx patterns, alternatives i.e. flat_regex_alternative are available which are less 'strict' in their matching.

Address Component lists and lookups have been created from Ordnance Survey Open Names. Contains OS data © Crown copyright and database right 2026. Licensed under the Open Government License v3.0. This dataset is updated quarterly in January, April, July and October.

Postcode processing is based upon the Annex C - Valid post code format specification.

Example Usage

See tutorial.ipynb for full use of all the functions within cleaning, validating, extracting, contextualising and workflows.

Metadata

Release files for address-toolkit 1.2.1

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

Source distribution (sdist)

Source distribution for address-toolkit 1.2.1
File Size Uploaded Provenance
address_toolkit-1.2.1.tar.gz 995.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for address-toolkit 1.2.1
File Interpreter ABI Platform
address_toolkit-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.0 MB

Release files / address_toolkit-1.2.1.tar.gz

Download URL address_toolkit-1.2.1.tar.gz
Size 995.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3e6039d233f9fe315577585c1f0929880fa28e73197fb87b7668c88383b04575
BLAKE2b-256 checksum
How to use checksums
6eb6bba4e592a34bc04b7efd8c04faf65c6c95ea8c4d4ba897da9381ff3af6f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / address_toolkit-1.2.1-py3-none-any.whl

Download URL address_toolkit-1.2.1-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c0a71049abbe898471832f9aec5a15c9bad84c704401aa3642168152c98ae670
BLAKE2b-256 checksum
How to use checksums
45d3fd095ecf247ad03d61afb28d78e00c939f7f77c4291476726ae1494f8586
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for address-toolkit 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files No provenance

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