Skip to main content

geo4bolivia

Subnational development data for Bolivia, ready to analyse, at every spatial scale.

geo4bolivia is the Python package of the GeoDevelopment Observatory of Bolivia. It loads the observatory's indicators for Bolivia's 339 municipalities (population, night-time lights, 64 indicators of the Municipal Atlas of the SDGs, satellite embeddings...) 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 geo4bolivia mapclassify             # mapclassify: for scheme="quantiles"
import geo4bolivia as geo

geo.datasets()                                       # what is available, at which scale and years
gdf = geo.load("sdg", variables="sdg1_2_mpi", years=2012, geometry=True)   # 339 municipalities
gdf.plot(column="sdg1_2_mpi", scheme="quantiles", k=5, legend=True)

Open in Colab

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 (INE, DS4Bolivia), 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): municipality BO-04-17-04 (La Paz) lies in province BO-04-17 (Murillo), which lies in department BO-04 (La Paz), which lies in Bolivia BO. INE codes and DS4Bolivia's asdf_id are kept as columns of geo.units(). Each dataset is a long panel keyed by geo_id and year.

Scale Units Example
country 1 BO
department 9 BO-04
province 112 BO-04-17
municipality 339 BO-04-17-04

Build your own indicator in five lines

!pip install -q geo4bolivia
import pandas as pd
import geo4bolivia as geo

mine = pd.read_csv("schools_by_municipality.csv")                 # e.g. columns mun_id (INE code), year, schools
mine = geo.link(mine, scale="municipality", on="mun_id", key="mun_id")   # 20101 -> BO-04-17-04
panel = geo.combine(["pop"], scale="municipality", extra=[mine])
panel["schools_per_10k"] = panel["schools"] / panel["pop"] * 1e4
geo.save(panel, "schools", scale="municipality", directory="my_data")

Open in Colab

From a raster:

!pip install -q "geo4bolivia[raster]"             # [raster] adds rasterio
import geo4bolivia as geo

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

Open in Colab

Then explore and model the panel with expdpy:

!pip install -q geo4bolivia expdpy
import numpy as np
import geo4bolivia as geo
import expdpy as ex

panel = geo.combine(["ntl", "pop"], scale="municipality", years=(2012, 2020))
panel["ln_pop"] = np.log(panel["pop"])
df, df_def = geo.for_expdpy(panel, labels={"ln_pop": "Log of population"})
df = ex.set_labels(df, df_def, set_panel=True)
ex.analyze_panel_table(df, "ln_NTLpc", ["ln_pop"])        # pooled, between, fixed and random effects

Open in Colab

Or analyse it spatially with geometrics:

!pip install -q geo4bolivia geometrics
import numpy as np
import geo4bolivia as geo
import geometrics as gm

ntl = geo.load("ntl")
ntl["NTLpc"] = np.exp(ntl["ln_NTLpc"])
gdf, df, df_dict = geo.for_geometrics(ntl, labels={"NTLpc": "Night-time lights per capita"})
df = gm.set_labels(df, df_dict, set_panel=True)
gm.analyze_beta_convergence(df, "NTLpc", gdf=gdf, w=gm.make_weights(gdf)).interpret()   # levels: logged internally

Open in Colab

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/geo4bolivia/main/data/municipality/ntl.csv")

Open in Colab

Installation

In a Google Colab cell:

!pip install -q geo4bolivia                     # core: pandas, numpy, geopandas, pyarrow, requests, pyyaml (Colab has them)
!pip install -q "geo4bolivia[raster]"           # + rasterio, for zonal()
!pip install -q git+https://github.com/quarcs-lab/geo4bolivia   # development version

Open in Colab

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.1.0") or the environment variable GEO4BOLIVIA_REF=v0.1.0.

Documentation

Citation

Mendez, C. (2026). GeoDevelopment Observatory of Bolivia. https://quarcs-lab.github.io/geo4bolivia/

MIT License. Original data sources are credited on each dataset page.

Metadata

Release files for geo4bolivia 0.1.0

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

Source distribution (sdist)

Source distribution for geo4bolivia 0.1.0
File Size Uploaded Provenance Actions
geo4bolivia-0.1.0.tar.gz 33.1 kB With provenance Details for geo4bolivia-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 76.9 kB

Release files / geo4bolivia-0.1.0.tar.gz

Download URL geo4bolivia-0.1.0.tar.gz
Size 33.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e0c753e35a9456f95d1162a70ab7be314ef4d9fe68663006ae70e7a428be15ed
BLAKE2b-256 checksum
How to use checksums
28bfb276d1c01569442728dd1c3cc1d50ea2dc1a9de26d69c03e256305194ee1
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 / geo4bolivia-0.1.0-py3-none-any.whl

Download URL geo4bolivia-0.1.0-py3-none-any.whl
Size 43.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
683a6bafc31716c7291e99e27b5d87b749f9b62070491e13305e7fb22477a014
BLAKE2b-256 checksum
How to use checksums
173e47e914b5f5e30eaa61886d433c36e2d2b1b4538a6d366df17c86500383b0
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 geo4bolivia 0.1.0

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 geo4bolivia-0.1.0.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