I have a dataframe with a (UK) postcode column, and a count column, e.g.
postcode count
SW1W0NY 10
PO167GZ 22
GU167HF 15
L18JQ 38
I wish to create a heatmap of this data using folium
, where the counts are aggregated as per larger (e.g. county-level) geographic polygons.
There are several online resources which map postcodes to lat/long, but is there any python library or resource which maps postcodes to larger UK geographic regions (e.g. county level)?
The Office of National Statistics has such mapping files:
Note that the mappings and codes are version/year specific, and may not be cross-compatible.