Skip to content

pycensus.census.countries.chile.casen.loader

Loader for Chile's Casen SAE comunal poverty estimates, returning a common-schema GeoDataFrame.

Technical aspects

Mirrors :mod:pycensus.census.countries.chile.ine.loader's shape (parquet cache via :mod:pycensus.cache, geometry from :mod:pycensus.census.countries.chile.geography), but the underlying source is a real bulk .xlsx download (see :mod:pycensus.census.countries.chile.casen.api) rather than a per-region API query -- so _fetch_missing fetches the (cached) national table once and filters to just the comunas in the requested region, instead of making a per-region network call.

Only "comuna" is implemented -- Casen SAE only publishes comuna- level estimates (region-level poverty is already directly estimable from the Casen survey itself without SAE, and isn't republished in this bulk file).

load(aoi=None, regions=None, level='comuna', year='latest', cache_dir=None, cache=True, data_dir=None)

Load Chile Casen SAE comunal poverty data as a common-schema GeoDataFrame.

Parameters:

Name Type Description Default
aoi Optional[GeoDataFrame]

Area of interest. Used to auto-detect regions if not given (via :func:pycensus.census.countries.chile.geography.regions_in_aoi), and to clip the final result.

None
regions Optional[Union[str, List[str]]]

Region name(s)/code(s) to load. Derived from aoi if omitted (aoi is then required).

None
level str

Must resolve to "comuna" -- the only level this source publishes.

'comuna'
year Union[int, str]

Vintage year, or "latest". Only 2022 (Casen 2022) is available.

'latest'
cache_dir Optional[str]

Root of pyCensus' parquet cache. Defaults to :func:pycensus.cache.default_cache_dir.

None
cache bool

If False, bypass the parquet cache entirely.

True
data_dir Optional[str]

Base directory for the raw .xlsx cache. Defaults to :data:pycensus.census.countries.chile.constants.DEFAULT_DATA_DIR.

None

Returns:

Type Description
GeoDataFrame

GeoDataFrame with GEOID, geometry, and one casen_cl-

GeoDataFrame

prefixed column per logical column in

GeoDataFrame

data:pycensus.census.countries.chile.casen.schema.SCHEMA.

Raises:

Type Description
ValueError

If neither regions nor aoi is given.