combine

combine(datasets, scale, years=None, extra=(), rules=None, ref=None)

Merge datasets into one panel at scale, aggregating finer ones up.

Parameters

Name Type Description Default
datasets Dataset ids, or {dataset: [variables]} to pick variables required
scale str Target scale; each dataset must be published at it or nest in it required
years As in geo.load None
extra Your own panels (with geo_id and year) at scale ()
rules dict | None Aggregation rules overriding the metadata, {variable: rule} None

Notes

Variables without an aggregation rule (none) are dropped, with a warning, when a dataset has to be aggregated. Clashing column names get the dataset id as a prefix (<dataset>_<column>). Weighted means fetch their weights as geo.aggregate() does (geo:weights in the metadata).

Example

!pip install -q geo4bolivia
import geo4bolivia as geo
import plotly.express as px

dep = geo.combine(["sdg03", "sdg04"], scale="department", years=2024)
dep = geo.add_names(dep)
px.scatter(dep, x="index_sdg3", y="index_sdg4", text="name",
           labels=geo.labels(dep), title="Health and education, ~2024")