geo4cambodia
Subnational development data for Cambodia, ready to analyse, at every spatial scale.
geo4cambodia is the Python package of the GeoDevelopment Observatory of Cambodia. It loads the observatory's indicators (district GDP per capita, province population, night-time lights, PM2.5, Global Data Lab HDI...) as tidy panels, with boundaries for every scale. It also lets you build your own indicators: link your tables to the same unit IDs, summarise rasters over units, move data across scales and combine datasets. It works out of the box in Google Colab: every example below runs as-is in a new Colab notebook.
!pip install -q geo4cambodia mapclassify # mapclassify: for scheme="quantiles"
import geo4cambodia as geo
geo.datasets() # what is available, at which scale and years
gdf = geo.load("gdppc", years=2022, geometry=True) # 202 districts, with boundaries
gdf.plot(column="y", scheme="quantiles", k=5, legend=True)
What it does
| Task | Functions |
|---|---|
| Load panels (one row per unit and year), names and boundaries | datasets, dictionary, load, units, boundaries, crosswalk |
| Link your own tables by unit names or codes, whatever the spelling | link, check |
| Extract indicators from rasters (Earth Engine exports, WorldPop, ...) | zonal |
| Move data up the hierarchy or onto grids and custom zones | aggregate, overlay, overlay_weights |
| Combine datasets at one scale and save new ones in the same format | combine, save |
| Analyse with expdpy (panel exploration, fixed and random effects) and geometrics (convergence, spatial dependence, inequality) | for_expdpy, for_geometrics |
One ID for every unit, at every scale
Every unit has a geo ID that nests by prefix (GADM 4.1 hierarchy): district KH-16-01 lies in province KH-16 (Phnom Penh), which lies in Cambodia KH. Global Data Lab regions (KH-GDL-02) are unions of whole provinces. Each dataset is a long panel keyed by geo_id and year.
| Scale | Units | Example |
|---|---|---|
country |
1 | KH |
province |
25 | KH-16 |
district |
202 | KH-16-01 |
gdl (Global Data Lab regions) |
17 | KH-GDL-02 |
Build your own indicator in five lines
!pip install -q geo4cambodia
import pandas as pd
import geo4cambodia as geo
mine = pd.read_csv("schools_by_province.csv") # e.g. columns Province, year, schools
mine = geo.link(mine, scale="province", on="Province") # "BântéayMéanchey" -> KH-01
panel = geo.combine(["env"], scale="province", extra=[mine])
panel["schools_per_10k"] = panel["schools"] / panel["total_GlobPOP_Count"] * 1e4
geo.save(panel, "schools", scale="province", directory="my_data")
From a raster:
!pip install -q "geo4cambodia[raster]" # [raster] adds rasterio
import geo4cambodia as geo
lights = geo.zonal("viirs_2020.tif", scale="district", stats=["sum", "mean"], name="ntl", year=2020)
Then explore and model the panel with expdpy:
!pip install -q geo4cambodia expdpy
import geo4cambodia as geo
import expdpy as ex
df, df_def = geo.for_expdpy("hdi")
df = ex.set_labels(df, df_def, set_panel=True)
ex.analyze_panel_table(df, "HDI", ["lnNTLpc"]) # pooled, between, fixed and random effects
Or analyse it spatially with geometrics:
!pip install -q geo4cambodia geometrics
import geo4cambodia as geo
import geometrics as gm
gdf, df, df_dict = geo.for_geometrics("gdppc")
df = gm.set_labels(df, df_dict, set_panel=True)
gm.analyze_beta_convergence(df, "y", gdf=gdf, w=gm.make_weights(gdf)).interpret() # levels: logged internally
Without the package
Every file is also a plain URL, readable with pandas alone (preinstalled in Colab, so nothing to install):
import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/quarcs-lab/geo4cambodia/main/data/district/gdppc.csv")
Installation
In a Google Colab cell:
!pip install -q geo4cambodia # core: pandas, geopandas, pyarrow, requests, pyyaml (Colab has them)
!pip install -q "geo4cambodia[raster]" # + rasterio, for zonal()
!pip install -q git+https://github.com/quarcs-lab/geo4cambodia # development version
Python 3.11 or later. The data are not inside the package. It reads them from the GitHub repository, so installation is quick and you always get the files the website links to. For reproducible research, pin a release of the data with geo.load(..., ref="v0.3.0") or the environment variable GEO4CAMBODIA_REF=v0.3.0.
Documentation
- How the data infrastructure works: scales, IDs, metadata, aggregation rules, and recipes for building indicators
- Dataset pages: variable dictionaries, coverage, sources and citations
- Website: indicators, notebooks, web apps and insights
Citation
Mendez, C., Khoun, T., & Poortinga, A. (2026). GeoDevelopment Observatory of Cambodia. https://quarcs-lab.github.io/geo4cambodia/
MIT License. Original data sources are credited on each dataset page.
Metadata
Release files for geo4cambodia 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geo4cambodia-0.3.2.tar.gz | 31.2 kB | With provenance | Details for geo4cambodia-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| geo4cambodia-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for geo4cambodia-0.3.2-py3-none-any.whl |
Total release size: 72.8 kB
Release files / geo4cambodia-0.3.2.tar.gz
| Download URL | geo4cambodia-0.3.2.tar.gz |
|---|---|
| Size | 31.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f24dc452bc28591f626cb7b543579bc60922305bd94210331e212204591d2e5
|
|
BLAKE2b-256 checksum How to use checksums |
a4aa01402d93d5b9a0b5ad7553586173406249220bd13fc1faed022d90a3bb19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / geo4cambodia-0.3.2-py3-none-any.whl
| Download URL | geo4cambodia-0.3.2-py3-none-any.whl |
|---|---|
| Size | 41.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3bc3ffd5de7c9a711727c94acdc531f2a0fe08e51f1585153844c187ee3bb01c
|
|
BLAKE2b-256 checksum How to use checksums |
9962fc0114a56af68aac7ec50de6cf382c3eb5e6bf640519dcfce3b19e5b2348
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logSecurity for geo4cambodia 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for geo4cambodia-0.3.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.