pycensus.census.countries.mexico.inegi¶
Mexico Census 2020 (Censo de Poblacion y Vivienda 2020) source.
Importing this module registers the gdf.inegi GeoDataFrame accessor
(see :mod:pycensus.accessors). Use :func:load to fetch data.
Technical aspects
Unlike US census data which has APIs, Mexico's INEGI Census 2020 data must be downloaded as files from INEGI's website. This module provides tools to: 1. Download census microdata and aggregated tables to data/mexico/ 2. Load and process the data into a common-schema GeoDataFrame 3. Cache processed data for efficient repeated access
Source
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 |