euromod_linking.dimensions¶
Population cells: how a shock’s group selects rows of the microdata.
A group key is either a EUROMOD input variable (deh=3-4, dgn=1,
dag=25-34, les=5) or the one named dimension with real structure,
region, which resolves to the finest regional column the dataset carries
(drgn2, else drgn1, else country) and understands the NUTS hierarchy.
Expressing cells in the model’s own variables is deliberate. Recoded category
labels — an external model’s own “low/medium/high skill” classes, say — are
meaningless outside the binding that invented them, cannot be looked up
anywhere, and silently fix an aggregation an analyst may not want. deh=3-4 is
self-describing, verifiable against the dataset, and needs no registry entry —
what a variable means and which coded values it takes are documented by EUROMOD
itself. An external model that publishes its own classes translates them to
variable ranges in its mapping spec, where model-specific semantics belong.
Value specs¶
deh=3 exact value
deh=3-4 inclusive range (``ddi=-1-0`` parses: signs are handled)
dag=65+ open upper bound
deh=3,5 set of values
Non-numeric values compare as strings (exact / set only).
Attributes¶
Exceptions¶
Inappropriate argument value (of correct type). |
Classes¶
Functions¶
|
Canonical form: keys sorted, "k=v;k2=v2". |
|
Region code label per row; empty when the dataset has no region column. |
|
|
|
Boolean mask: which rows of series the spec selects. |
|
Parse a canonical group string "k=v;k2=v2" into a dict ("" -> {}). |
|
Parse a group value into a ValueSpec. Raises DimensionError. |
|
Finest available region column ("" -> country level). Deterministic: |
|
|
|
True when two specs can select the same row — ambiguous cell membership. |
|
Dataset-aware problems: every key must be region or a dataset column. |
|
Syntax-only problems with a group string ([] = ok). |
Module Contents¶
- exception euromod_linking.dimensions.DimensionError[source]¶
Inappropriate argument value (of correct type).
- class euromod_linking.dimensions.ValueSpec[source]¶
A parsed group value: what rows of one variable it selects.
- euromod_linking.dimensions.canonical_group(pairs: Mapping[str, str] | str) str[source]¶
Canonical form: keys sorted, “k=v;k2=v2”.
- euromod_linking.dimensions.derive_region(df: pandas.DataFrame) pandas.Series[source]¶
Region code label per row; empty when the dataset has no region column.
- euromod_linking.dimensions.matches(series: pandas.Series, spec: ValueSpec) pandas.Series[source]¶
Boolean mask: which rows of series the spec selects.
- euromod_linking.dimensions.parse_group(group: str) dict[str, str][source]¶
Parse a canonical group string “k=v;k2=v2” into a dict (”” -> {}).
- euromod_linking.dimensions.parse_value_spec(spec: str) ValueSpec[source]¶
Parse a group value into a ValueSpec. Raises DimensionError.
- euromod_linking.dimensions.region_column(df_columns, dim: Dimension = REGION) str | None[source]¶
Finest available region column (”” -> country level). Deterministic: the declared column first, then fallbacks in declared order.
- euromod_linking.dimensions.specs_overlap(a: ValueSpec, b: ValueSpec) bool[source]¶
True when two specs can select the same row — ambiguous cell membership.
- euromod_linking.dimensions.validate_group_columns(group: str, columns) list[str][source]¶
Dataset-aware problems: every key must be region or a dataset column.
- euromod_linking.dimensions.validate_group_syntax(group: str) list[str][source]¶
Syntax-only problems with a group string ([] = ok).
Deliberately does NOT check that a key is a real dataset column — that is a dataset-aware check (see validate_group_columns), applied once the dataset is known.
- euromod_linking.dimensions.REGION¶