Geospatial analysis in Python
In this weekโs workshop, we will use the GeoPandas library to explore geospatial data. We will load vector boundaries, convert data with coordinates into a GeoDataFrame, run a spatial join and create a choropleth map.
Introduction
Live coding
Review the material that we explored in Week 7โs live-coding session.
Lab
Exercise: Which state had the highest underemployment rate in 2023?
Your task is to create a choropleth map showing the underemployment rate for each state using data from the 2023 Labour Force Survey (Table 13).
- Load the necessary libraries
- Read the
underemploymentCSV file - Read the
nigeriaGeoJSON file - Merge the datasets using the
statejoining variable - Create a choropleth map
Further reading
- Dorman, M., Graser, A., Nowosad, J., & Lovelace, R. (2025). Geocomputation with Python. CRC Press. https://py.geocompx.org/
- Rey, S.J., Arribas-Bel, D., & Wolf, L.J. (2023). Geographic Data Science with Python. CRC Press. https://geographicdata.science/book/intro.html
- Office for National Statistics Geospatial Team. (2021). Introduction to GIS in Python. https://onsgeo.github.io/geospatial-training/docs/intro_to_gis_in_python
Other useful resources
- ColorBrewer - for colour-blind friendly palettes
- mapshaper.io - for simplifying vector data and exporting to different file types
- geojson.io - for inspecting GeoJSON files