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.

!pip install geo4cambodia -q            # in Colab; `pip install geo4cambodia` elsewhere

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

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:

lights = geo.zonal("viirs_2020.tif", scale="district", stats=["sum", "mean"], name="ntl", year=2020)

Then explore and model the panel with expdpy:

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:

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, for R, Stata, Excel or pandas alone:

import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/quarcs-lab/geo4cambodia/main/data/district/gdppc.csv")

Installation

pip install geo4cambodia                    # core: pandas, geopandas, pyarrow, requests, pyyaml
pip install "geo4cambodia[raster]"          # + rasterio, for zonal()
pip install 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.1

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.1
File Size Uploaded Provenance Actions
geo4cambodia-0.3.1.tar.gz 31.2 kB With provenance Details for geo4cambodia-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 72.6 kB

Release files / geo4cambodia-0.3.1.tar.gz

Download URL geo4cambodia-0.3.1.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4737c1c62963d511811c9a5396380e7b17ce94820a5c94d01ecc802cce43aa07
BLAKE2b-256 checksum
How to use checksums
4783957a578b761a1fecedd2901da493af47e7f2cc7fd94848e057608ca6cb8c
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.1-py3-none-any.whl

Download URL geo4cambodia-0.3.1-py3-none-any.whl
Size 41.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53d5efa1923345ba0abb2ae2d86ce9e6c82736c51809811235274675e4121d35
BLAKE2b-256 checksum
How to use checksums
636dc9f8a1e7e4d61ade171c0da35a61a5527757f692996c33814a681c3bf4a3
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.1

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