Twinkle HubTwinkle Hub

美國十年人口普查資料查詢 (2020 PL / DHC / 2010 SF1)

us_query_decennial

🇺🇸 États-Unislecture seule

關鍵字 / Keywords: 美國 十年 人口普查 2020 2010 2000 PL DHC redistricting census decennial dec pl dhc sf1 population race hispanic housing units state county block

Scope: US Census Bureau · Decennial Census.

Query the every-10-years constitutionally-mandated Census (used for congressional apportionment, federal funding formulas, and as the universe for every subsequent ACS estimate). Response matrix is converted to rows: [{col: val}, ...].

Endpoint: https://api.census.gov/data/{year}/dec/{dataset}?get={vars}&for={for_geo}&in={in_geo}

Args: year: 2020, 2010, 2000, 1990. variables: decennial variable codes. Common: - "P1_001N" — total population (2020 PL / DHC) - "P2_002N" — Hispanic / Latino population (2020 PL) - "H1_001N" — total housing units (2020 PL) - "P0010001" — total population (2010 SF1) for_geo: same syntax as us_query_acs. in_geo: parent scope for hierarchical queries. dataset: decennial sub-dataset: - "pl" — PL 94-171 (redistricting · earliest release) - "dhc" — DHC (Demographic & Housing Characteristics, 2020 full detail) - "sf1" — Summary File 1 (2010 / 2000 · legacy) - "dp" — Demographic Profile (2020) - "ddhca" — Detailed DHC-A Default "pl" (available for 2020, 2010, 2000).

Returns dict with columns, rows, total_rows, raw_matrix. Same gate / key logic as us_query_acs. License: US Public Domain (17 USC §105).

Paramètres

NomTypeDescription
year *integer | string
variables *array
for_geo *string
in_geostring
datasetstring
Schéma JSON brut
{
  "properties": {
    "year": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "title": "Year"
    },
    "variables": {
      "items": {
        "type": "string"
      },
      "title": "Variables",
      "type": "array"
    },
    "for_geo": {
      "title": "For Geo",
      "type": "string"
    },
    "in_geo": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "In Geo"
    },
    "dataset": {
      "default": "pl",
      "title": "Dataset",
      "type": "string"
    }
  },
  "required": [
    "year",
    "variables",
    "for_geo"
  ],
  "title": "us_query_decennialArguments",
  "type": "object"
}

Comment appeler

Amorce — paramètres dans le tableau
us_query_decennial({ year: 10 })