pycancensus.list_census_regions
- pycancensus.list_census_regions(dataset: str, use_cache: bool = True, quiet: bool = False, api_key: str | None = None) DataFrame[source]
Query the CensusMapper API for available regions in a given dataset.
- Parameters:
dataset (str) – The dataset to query for available regions (e.g., ‘CA16’).
use_cache (bool, default True) – If True, data will be read from local cache if available.
quiet (bool, default False) – When True, suppress messages and warnings.
api_key (str, optional) – API key for CensusMapper API. If None, uses environment variable.
- Returns:
DataFrame with columns: - region: The region identifier - name: The name of that region - level: The census aggregation level of that region - pop: The population of that region - municipal_status: Additional identifiers for municipal status - CMA_UID: The identifier for the Census Metropolitan Area (if any) - CD_UID: The identifier for the Census District (if any)
- Return type:
pd.DataFrame
Examples
>>> import pycancensus as pc >>> regions = pc.list_census_regions("CA16") >>> print(regions.head())