pycensus.census.countries.spain.constants¶
Static Spain geography reference data shared by every Spain census source.
Technical aspects
Boundary files for Spain will be fetched from INE's geographic data. This module maps logical level names to the functions that fetch them, the geography hierarchy, and configuration for data loading.
Spain's administrative divisions: - Nation (country level) - Autonomous Community (comunidad autónoma) - 17 autonomous communities + 2 autonomous cities - Province (provincia) - 50 provinces + 2 autonomous cities - Municipality (municipio) - equivalent to city/town - District (distrito) - within municipalities - Section (sección censal) - census section, equivalent to tract - Block (manzana) - city block
Province codes below are INE's real 2-digit codification, cross-checked
against GISCO's LAU LAU_ID prefixes and INE's own OGC API Features
CPRO field (both verified live in :mod:pycensus.spain.geography,
e.g. CPRO="20" == Gipuzkoa, LAU_ID="44001" == Ababuj, Teruel
(province "44")). An earlier version of this module had these codes
shifted/fabricated (e.g. "23"=La Coruña, "28"=Lugo, missing Ceuta/
Melilla as 51/52) -- see tests/test_spain.py::
test_province_code_matches_real_ine_codification for the regression
guard.
Source
https://www.ine.es/
autonomous_community_code(ac_name_or_abbr)
¶
Return the 2-digit INE code for an autonomous community name or abbreviation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ac_name_or_abbr
|
str
|
Autonomous community name, abbreviation, or 2-digit code. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Two-digit INE autonomous community code. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the input does not resolve to a known autonomous community. |
autonomous_community_abbr(ac_name_or_code)
¶
Return the abbreviation for an autonomous community name or code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ac_name_or_code
|
str
|
Autonomous community name or 2-digit code. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Abbreviation for the autonomous community. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the input does not resolve to a known autonomous community. |
province_code(prov_name_or_abbr)
¶
Return the 2-digit INE code for a province name or abbreviation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prov_name_or_abbr
|
str
|
Province name, abbreviation, or 2-digit code. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Two-digit INE province code. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the input does not resolve to a known province. |
province_abbr(prov_name_or_code)
¶
Return the abbreviation for a province name or code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prov_name_or_code
|
str
|
Province name or 2-digit code. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Abbreviation for the province. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the input does not resolve to a known province. |