This project creates a mapping to convert between postcodes and the proposed Westminster constituency electoral boundaries from the 2023 reviews of the English, Scottish, Welsh and Northern Irish boundary commissions.
This project also creates mappings from wards to constituencies, and from constituencies to wards.
In addition to using the underlying mapping CSV files directly, a simple UI for converting postcodes into their corresponing constituencies is available here.
The generated conversion file mapping postcodes to new Westminster constituencies, output/postcode_to_constituency_mapping.csv
, can be found here.
A mapping of wards to new Westminster constituencies, output/ward_to_constituencies_mapping.csv
, can be found here.
A mapping of new Westminster constituencies to wards, output/constituency_to_wards_mapping.csv
, can be found here.
Caveat: output/postcode_to_constituency_mapping.csv
contains >2 million rows, Microsoft Excel can't display this many rows and will truncate the dataset.
Check the errors here.
The mapping includes English, Scottish, Welsh and Northern Irish postcodes.
The mapping only includes active postcodes (i.e. postcodes that haven't been terminated).
The mapping excludes postcodes that don't have corresponding grid references in the ONS data (an entry is added to output/errors.csv
for these postcodes).
The mapping excludes postcodes that don't fall within an electoral boundary (an entry is added to output/errors.csv
for these postcodes).
- Clone the project
- Install the dependencies (e.g. using miniconda)
- Run
python analyse_postcodes.py
- (Optional) To generate the ward-constituency and constituency-ward mappings, run
python analyse_wards.py
- N.B. this requires step 3 to have been run already