load
load(
dataset,
scale=None,
years=None,
variables=None,
wide=None,
geometry=False,
names=False,
groups=None,
ref=None,
)Load a dataset as a panel: one row per unit (geo_id) and year.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| dataset | str | Dataset id (see geo.datasets()) |
required |
| scale | str | None | Scale to load; defaults to the dataset’s native scale | None |
| years | An int, a list of ints, or a (first, last) range (inclusive) |
None |
|
| variables | A variable or list of variables to keep (geo_id and year are always kept); geo.search() and geo.dictionary() list them |
None |
|
| wide | str | None | A variable name; returns one row per unit with one column per year (<variable><year>) |
None |
| geometry | bool | Attach unit boundaries (and names) and return a GeoDataFrame | False |
| names | bool | Add the unit name |
False |
| groups | Coarser scales whose unit names to add as columns, e.g. ["department"] adds a department column (implies names) |
None |
|
| ref | str | None | Git branch, tag or commit to read from GitHub (default: local checkout or main) |
None |
Notes
Raises ValueError for unknown variables, and for years that have no rows (listing the years the dataset has).
Example
!pip install -q geo4bolivia
import geo4bolivia as geo
import plotly.express as px
df = geo.load("sdg05", variables=["index_sdg5"], years=[2012, 2024],
groups=["department"])
px.histogram(df, x="index_sdg5", color="year", barmode="overlay",
labels=geo.labels(df), title="Gender equality index")