crosswalk

crosswalk(source, target, ref=None)

Links between two scales: geo_id_from, geo_id_to, weight_area.

Parameters

Name Type Description Default
source str The finer scale, e.g. "municipality" required
target str A coarser scale it nests in, e.g. "department" required

Returns

Name Type Description
pandas.DataFrame weight_area is the share of the source unit’s area inside the target unit (1.0 for nested scales). Crosswalks are published for every pair of active scales where one nests in the other, from finer to coarser.

Example

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

xw = geo.crosswalk("municipality", "department")
n = xw.groupby("geo_id_to", as_index=False).size()
n["department"] = n["geo_id_to"].map(geo.units("department")
                                     .set_index("geo_id")["name"])
px.bar(n, x="department", y="size", title="Municipalities per department")