UK open data in Python for civil society, from charities and community groups to researchers and students. Load public data from official sources, join it to your own, and get figures you can check. The first datasets are geographic boundaries, official statistics, postcodes and deprivation indices, with more on the way.
Made by KindTech UK. Up to version 0.1 the
package was called kindtech.
- Data modules.
uk_open_data.geoloads boundaries from the ONS Geoportal,uk_open_data.onsloads statistics from the Nomis API,uk_open_data.postcodesturns postcodes into geography codes, anduk_open_data.imdloads the deprivation indices. Bring your own DataFrame backend, pandas or polars. - Analyses. Each analysis answers one question a charity asks of its own data, such as "Are we reaching people in the most deprived neighbourhoods?". It returns totals, the working, the sources and what a person must check. Nothing in a result describes one person.
- A command line.
uk-open-data analysis runruns an analysis on a file without writing any Python. - A connector for chat assistants. The same analyses and data as tools for an assistant such as Claude or ChatGPT. The assistant sees totals, never rows.
These analyses follow work first done by DataKind UK volunteers with charities.
Install uk-open-data from PyPI:
uv add uk-open-dataThe uk-open-data package includes uk_open_data.geo, uk_open_data.ons,
uk_open_data.postcodes, and uk_open_data.imd. See the
package FAQ for how these
subpackages are installed and released together.
import pandas as pd # or polars
from uk_open_data import (
geodata_to_properties,
load_geodata,
load_ons,
postcodes_to_geography,
)
# Local authority boundaries from the ONS Geoportal
geojson = load_geodata(geography_type="LAD", year="2025", boundary_type="BUC")
areas = pd.DataFrame(geodata_to_properties(geojson, "LAD", 2025))
# Population of each local authority from Nomis: all persons, all ages
population = load_ons(
"population",
geography_type="LAD",
time="latest",
measures=20100,
gender=0,
c_age=200,
select=["geography_code", "obs_value"],
)
# Every dataset has a geography_code column, so they join directly
areas = areas.merge(population, on="geography_code")
# Your own postcodes, placed in the same local authorities
located = postcodes_to_geography(["SE13 7HX", "SE6 4RU"], geography_type="LAD")
located.merge(population, on="geography_code")
# postcode geography_code geography_name obs_value
# 0 SE13 7HX E09000023 Lewisham 301037
# 1 SE6 4RU E09000023 Lewisham 301037The user guide covers each module.
Interactive notebooks you can run in the browser:
| Notebook | Description |
|---|---|
| Browse and load ONS datasets from the NOMIS API | |
| Explore UK geographic boundaries | |
| Join boundaries with statistics |
End-to-end reproductions of DataKind UK charity
projects, each chaining several connectors on geography_code:
See the case studies in the docs for the full write-ups and figures.
The same loaders work for coursework, a dissertation or a research project. Each one fetches from an official source, and Data sources explains the APIs behind them. The notebooks above run in the browser with nothing to install.
Students and researchers are welcome to contribute: a new data source, a worked analysis, or a fix to the docs. Read the contributing guide and DEVELOPERS.md, then open an issue to say what you would like to work on.
In Claude Code, install the plugin:
/plugin marketplace add KindTechUK/plugins
/plugin install uk-open-data@kindtech
For other assistants, the connector offers the analyses and data over the Model Context Protocol. Coding agents can read the docs as Markdown: llms.txt lists every page, and llms-full.txt holds them all in one file.
See DEVELOPERS.md for development setup and workflow instructions.
Apache-2.0. See LICENSE and NOTICE. Version 0.1.0 was published under the MIT License; its notice is kept in NOTICE.