Check the setup
- Python 3.10 or newer
- A notebook environment such as Jupyter or Google Colab
- A free Census Data API key saved in the CENSUS_API_KEY environment variable
Annual U.S. demographic, housing, social, and economic estimates for building local market-sizing, site-selection, and community comparison tools.
From source to product signal
ACS 5-year products provide annual estimates for every U.S. community down to small geographic areas. Start with a few documented variables at the state level before moving to tracts or block groups. Every estimate must be interpreted with its margin of error, and overlapping five-year periods are not independent observations.
Install the packages, then run the notebook cell.
python -m pip install pandas requests
import os
import pandas as pd
import requests
variables = [
"NAME",
"B01003_001E", "B01003_001M",
"B19013_001E", "B19013_001M",
]
response = requests.get(
"https://api.census.gov/data/2024/acs/acs5",
params={
"get": ",".join(variables),
"for": "state:*",
"key": os.environ["CENSUS_API_KEY"],
},
timeout=30,
)
response.raise_for_status()
rows = response.json()
states = pd.DataFrame(rows[1:], columns=rows[0])
print(states.head())Test a useful signal
Test whether population and median household income can support an initial state-level market-sizing signal.
U.S. Census Bureau is a government source. Last verified 2026-08-11. Temporal coverage: 2009-present.