pycancensus.list_census_vectors
- pycancensus.list_census_vectors(dataset: str, use_cache: bool = True, quiet: bool = False, api_key: str | None = None) DataFrame[source]
Query the CensusMapper API for available vectors for a given dataset.
- Parameters:
dataset (str) – The dataset to query for available vectors (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: - vector: Short code for the variable - type: Whether it’s a female, male, or total aggregate - label: Name of the variable - units: Whether the value represents a numeric integer, percentage,
dollar figure, or ratio
parent_vector: Hierarchical relationship
aggregation: Whether the value is additive or a transformation
- details: Detailed description generated by traversing all labels
within its hierarchical structure
- Return type:
pd.DataFrame
Examples
>>> import pycancensus as pc >>> vectors = pc.list_census_vectors("CA16") >>> print(vectors.head())