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 (the SDG Atlas 2026 of SDSN Bolivia, with the Sustainable Development Index and each goal's index and indicators near 2012 and near 2024, population, night-time lights, 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
import geo4bolivia as geo
import plotly.express as px                         # interactive maps and charts (preinstalled in Colab)

geo.datasets()                                       # what is available, at which scale and years
gdf = geo.load("sdg", years=2024, geometry=True)    # 343 municipalities
px.choropleth_map(gdf, geojson=gdf.geometry, locations=gdf.index, color="index_sdg",
                  hover_name="name", center={"lat": -16.3, "lon": -64}, zoom=4)

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 (numbered as in GADM 4.1): municipality BO-04-17-04 (Nuestra Señora de 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(). The municipalities (geometry=True, geo.boundaries()) are the 343 municipalities and indigenous autonomies of SDSN Bolivia's municipal map of 2025, used with SDSN Bolivia's permission. Each dataset is a long panel keyed by geo_id and year.

Scale Units Example
country 1 BO
department 9 BO-04
province 113 BO-04-17
municipality 343 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.4.0") or the environment variable GEO4BOLIVIA_REF=v0.4.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.4.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.4.0
File Size Uploaded Provenance Actions
geo4bolivia-0.4.0.tar.gz 42.9 kB With provenance Details for geo4bolivia-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 98.3 kB

Release files / geo4bolivia-0.4.0.tar.gz

Download URL geo4bolivia-0.4.0.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a8c6d2af4048a7c2392afee3fef1a3465f18e790f520313433c049940f4f8264
BLAKE2b-256 checksum
How to use checksums
62f778cc707dcef3f859149f0666c0a73482f9f8ba7a9c77e43f78be586fce94
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 Nov 17, 2026.

Transparency log

Release files / geo4bolivia-0.4.0-py3-none-any.whl

Download URL geo4bolivia-0.4.0-py3-none-any.whl
Size 55.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07c7faa3c3dcddaecfa9180ec140e02ab9fd5fa6c808928a362a85c10c93b123
BLAKE2b-256 checksum
How to use checksums
b25bc161449dc4085a540383c1d3f3dd5fe8a8f4bee20d074ef832bedb4b54a4
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 Nov 17, 2026.

Transparency log

Security for geo4bolivia 0.4.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for geo4bolivia-0.4.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 Nov 17, 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