Skip to content

pycensus.census.countries.usa.dhc

2020 Decennial Census DHC (Demographic and Housing Characteristics) source.

Importing this module registers the gdf.dhc GeoDataFrame accessor (see :mod:pycensus.accessors). Use :func:load to fetch data.

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 states if not given, and to clip the final result.

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

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

None
level str

Standard geometry level (:data:pycensus.geometry_levels.STANDARD_LEVELS); "dec/dhc" is available down to "block".

'block'
year Union[int, str]

Vintage year, or "latest".

'latest'
api_key Optional[str]

Census API key. Resolved via :func:pycensus.api_keys.resolve_api_key if not given.

None
cache_dir Optional[str]

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

None
cache bool

If False, bypass the cache entirely -- always fetch fresh and don't persist the result.

True

Returns:

Type Description
GeoDataFrame

GeoDataFrame with GEOID, geometry, and one dhc_-prefixed

GeoDataFrame

column per logical column in :data:pycensus.usa.dhc.schema.SCHEMA.

Raises:

Type Description
ValueError

If neither states nor aoi is given.