pycensus.census.countries.canada.statcan¶
Statistics Canada (StatCan) 2021 Census source.
Importing this module registers the gdf.statcan GeoDataFrame accessor
(see :mod:pycensus.accessors). Use :func:load to fetch data.
Technical aspects
StatCan has no per-region queryable API used here -- data is fetched
via the Full Table Download (bulk CSV) route
(:mod:pycensus.canada.api), the same shape as
:mod:pycensus.mexico.inegi's ITER downloader.
Source
https://www150.statcan.gc.ca/n1/en/tbl/csv/98100002-eng.zip
load(aoi=None, provinces=None, level='municipality', year='latest', cache_dir=None, cache=True, data_dir=None)
¶
Load StatCan 2021 Census data as a common-schema GeoDataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aoi
|
Optional[GeoDataFrame]
|
Area of interest. Used to auto-detect |
None
|
provinces
|
Optional[Union[str, List[str]]]
|
Province name(s)/abbreviation(s)/PRUID(s) to load.
Derived from |
None
|
level
|
str
|
Standard geometry level name. Only |
'municipality'
|
year
|
Union[int, str]
|
Vintage year, or |
'latest'
|
cache_dir
|
Optional[str]
|
Root of pyCensus' parquet cache. Defaults to
:func: |
None
|
cache
|
bool
|
If |
True
|
data_dir
|
Optional[str]
|
Base directory for StatCan's raw downloaded files
(Census Profile CSV, boundary zips). Defaults to
:data: |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
GeoDataFrame with |
GeoDataFrame
|
column per logical column in :data: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither |