pycensus.census.countries.usa.dhc.loader¶
Loader for the 2020 Decennial Census DHC, returning a common-schema GeoDataFrame.
Technical aspects
Mirrors :mod:pycensus.usa.acs.loader: reads as much as possible from
pyCensus' parquet cache (:mod:pycensus.cache), fetching only the
logical columns actually missing via
:func:pycensus.usa.api.fetch_variables, and merges the result back
into the shared per-level/region cache file. Output columns are
prefixed dhc_.
load(aoi=None, states=None, level='block', year='latest', api_key=None, cache_dir=None, cache=True)
¶
Load Decennial Census DHC 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)/FIPS code(s) to load. Derived
from |
None
|
level
|
str
|
Standard geometry level
(:data: |
'block'
|
year
|
Union[int, str]
|
Vintage year, or |
'latest'
|
api_key
|
Optional[str]
|
Census API key. Resolved via
:func: |
None
|
cache_dir
|
Optional[str]
|
Root of pyCensus' parquet cache. Defaults to
:func: |
None
|
cache
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
GeoDataFrame with |
GeoDataFrame
|
column per logical column in :data: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither |