關鍵字 / Keywords: 美國人口普查 變數 metadata 欄位 定義 label concept universe group ACS census variable variables B01001 estimate margin of error
Scope: US Census Bureau · api.census.gov variable metadata.
Look up one variable's human-meaningful metadata — the label (e.g. "Estimate!!Total:"), concept (e.g. "Sex by Age"), group (e.g. "B01001"), universe (e.g. "Total population"), predicate type (int / float / string), and attribute variables (margin of error, annotations).
Endpoint (falls back to variables.json sheet if single-var 404s): https://api.census.gov/data/{year}/{dataset}/variables/{variable}.json
Args: year: vintage year (e.g. 2022, "2020"). dataset: dataset path — "acs/acs5", "acs/acs1", "dec/pl", "dec/dhc", "pep/population", "ecnbasic", ... variable: variable code. Naming convention: - "B" prefix (e.g. "B01001_001E") = ACS detailed tables - "S" prefix = ACS subject tables - "DP" prefix = ACS data profiles - "P"/"H" prefix (e.g. "P1_001N") = decennial - Suffix "_E" = estimate, "_M" = margin of error, "_EA" / "_MA" = estimate/margin annotation flag, "_N" = number (decennial)
Returns dict with name, label, concept, group,
predicate_type, attributes, universe, and raw (the full
upstream entry). No API key required. License: US Public Domain.