Catalog PyPI
Back to packageRELEASE DETAILS

1.2.1

PyPI

address-toolkit

Toolkit for cleaning, validating, extracting and contextualising GB address data with PySpark.

addressaddress-cleaningaddress-contextualisingaddress-extractingaddress-validatingpostcode
Published18 Mar 2026
Direct dependencies2
Transitive dependenciesNot calculated

README

Version 1.2.1 documentation

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 NameDescriptionIncludes
cleaningContains functions to clean addressesclean_punctuation, denoise_addresses, deduplicate_addresses, deduplicate_postcodes, rectify_postcodes, standardise_street_types, prettify_addresses
validatingContains functions to validate addressesvalidate_from_list, validate_from_regex, validate_postcodes
extractingContains functions to extract address componentsextract_from_list, extract_from_regex, extract_postcodes
contextualisingContains functions to contextualise addressescontextualise_from_lookup
workflowsContains functions to streamline processingclean_addresses, validate_addresses, extract_address_components

Supplementary Package Contents (Resources):

ResourceIncludes
UK Postcode Regexpostcode_regex
Unit Address Level Regexflat_regex, room_regex, unit_regex, block_regex, apartment_regex, floor_regex
Noise Regexconsecutive_letters_regex
Miscellaneous Regexmisc_numbers_regex, standalone_numbers_regex, txt_before_numbers_regex, end_address_numbers_regex, start_address_numbers_regex, end_address_identifier_regex
Address Component Liststown_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 Listscontextual_keywords, misc_keywords_list, misc_special_keywords
Address Component Lookupstown_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.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 2

Native requirements
2 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
pyspark
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "<3.11,>=3.9",
  "evaluation": "NOT_EVALUATED"
}
pyspark==3.3.2runtime
RapidFuzz
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "<3.11,>=3.9",
  "evaluation": "NOT_EVALUATED"
}
RapidFuzz==3.13.0runtime

Distribution files

2 collected
address_toolkit-1.2.1-py3-none-any.whl

bdist_wheel · 990.65 KB · Python py3

Source file
address_toolkit-1.2.1.tar.gz

sdist · 972.17 KB · Python source

Source file

Repository

PENDING
onsdigital/address-toolkit

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:23 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:2f0e598cf2ed09bdb804607d03192ff2d015eb539d26231d2c1a640c7fb54a1f

Other collected versions

View all collected versions →