pycensus.census.countries.mexico.inegi.loader¶
Loader for INEGI Census (Censo de Poblacion y Vivienda) 2020, returning a common-schema GeoDataFrame.
Technical aspects
Mirrors :mod:pycensus.usa.acs5.loader's shape: reads as much as
possible from pyCensus' parquet cache (:mod:pycensus.cache),
fetching only the logical columns actually missing, and merges the
result back into the shared per-level/region cache file. The
difference from every usa.* source is that INEGI has no queryable
API -- :mod:pycensus.mexico.api downloads and caches INEGI's bulk
per-state ITER CSV on disk (independent of, and upstream of,
:mod:pycensus.cache's parquet cache) the first time any column is
requested for a state, then every subsequent column/level request for
that state is served from the already-downloaded file.
state, municipality, ageb (urban only), and block
(urban only) levels are implemented. ageb/block-level
attribute columns come from a different INEGI bulk file, RESAGEBURB
(:func:pycensus.mexico.api.fetch_ageb_totals/
:func:pycensus.mexico.api.fetch_block_totals), not ITER (see
:mod:pycensus.mexico.geography for the live end-to-end verification
of the block boundary/attribute pairing).
Source
INEGI Census 2020: https://www.inegi.org.mx/programas/ccpv/2020/
load(aoi=None, states=None, level='municipality', year='latest', cache_dir=None, cache=True, data_dir=None)
¶
Load INEGI Census 2020 data as a common-schema GeoDataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aoi
|
Optional[GeoDataFrame]
|
Area of interest. Used to auto-detect |
None
|
states
|
Optional[Union[str, List[str]]]
|
State name(s)/abbreviation(s)/code(s) to load. Derived
from |
None
|
level
|
str
|
Standard geometry level name. |
'municipality'
|
year
|
Union[int, str]
|
Vintage year, or |
'latest'
|
cache_dir
|
Optional[str]
|
Root of pyCensus' parquet cache (geometry + attribute
columns, merged per level/region). Defaults to
:func: |
None
|
cache
|
bool
|
If |
True
|
data_dir
|
Optional[str]
|
Base directory for INEGI's raw downloaded files (ITER
CSVs, Marco Geoestadistico zips). Defaults to
:data: |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
GeoDataFrame with |
GeoDataFrame
|
column per logical column in :data: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither |