SDMX (compat.sdmx
)#
Note that this package is available in PyPI as sdmx1
.
To install the correct package, use:
pip install genno[sdmx]
To ensure the function is available:
c = Computer()
c.require_compat("genno.compat.sdmx")
c.add(..., "codelist_to_groups", ...)
- genno.compat.sdmx.codelist_to_groups(codes: sdmx.model.common.Codelist | Iterable[sdmx.model.common.Code], dim: str | None = None) Mapping[str, Mapping[str, List[str]]] [source]#
Convert codes into a mapping from parent items to their children.
The returned value is suitable for use with
aggregate()
.- Parameters:
codes – Either a
sdmx.Codelist
object or any iterable ofsdmx.Code
.dim (
str
, optional) – Dimension to aggregate. If codes is a code list and dim is not given, the ID of the code list is used; otherwise dim must be supplied.