Skip to main content

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 in a new Colab notebook (replace the placeholder files, such as your own table or raster, with yours).

!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, numpy, 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

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.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geo4cambodia 0.3.3
File Size Uploaded Provenance Actions
geo4cambodia-0.3.3.tar.gz 31.8 kB With provenance Details for geo4cambodia-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geo4cambodia 0.3.3
File Interpreter ABI Platform Actions
geo4cambodia-0.3.3-py3-none-any.whl Python 3 none any Details for geo4cambodia-0.3.3-py3-none-any.whl

Total release size: 73.9 kB

Release files / geo4cambodia-0.3.3.tar.gz

Download URL geo4cambodia-0.3.3.tar.gz
Size 31.8 kB
Tags Source
SHA-256 checksum
How to use checksums
38ab2efd6277884599d0300eaece24af3fdbcb8326cc5f2a491d125db8337707
BLAKE2b-256 checksum
How to use checksums
2edf9d31f922c5d7eb971389eeb839580afd890945ae2bc3fa3b3d900650f10c
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 log

Release files / geo4cambodia-0.3.3-py3-none-any.whl

Download URL geo4cambodia-0.3.3-py3-none-any.whl
Size 42.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df92634612ca7d184ea8f0ffe0bc5954853eb0b72af3932ea0174548802412c6
BLAKE2b-256 checksum
How to use checksums
a1b3e71ad4b4239bec9676df1efe154d0abbd77ddac973de6563341f43f3e9f9
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 log

Security for geo4cambodia 0.3.3

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.

Select from 2 files

Attestation for geo4cambodia-0.3.3.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page