The BEA provides economic data and statistics for the United States, including measures of GDP, national income, consumer spending and trade balances.
The BEA provides bulk data downloads as CSV/Excel in addition to their API. Engineers download NIPA tables directly or use the `beaapi` Python wrapper. Regional economic data is indexed by FIPS code, enabling joins with Census and other geographic datasets.
BEA national accounts data enables AI systems to reason about the structure of the US economy. Build a RAG system on BEA input-output tables so an LLM can answer 'How dependent is the auto industry on steel manufacturing?' with official economic data, or train forecasting models on GDP component time-series.
# pip install requests pandas
import requests, pandas as pd
resp = requests.get("https://apps.bea.gov/api/data/", params={
"UserID": "YOUR_API_KEY", "method": "GetData",
"datasetname": "Regional", "TableName": "CAGDP1",
"LineCode": 1, "GeoFips": "STATE",
"Year": "2022", "ResultFormat": "JSON"
})
data = resp.json()["BEAAPI"]["Results"]["Data"]
df = pd.DataFrame(data)[["GeoName", "TimePeriod", "DataValue"]]
print(df.nlargest(5, "DataValue"))Official dataset source
More datasets used by Python data engineers.
The Federal Reserve Bank of St. Louis FRED database provides over 800,000 economic time series from 100+ sources, including interest rates, inflation, GDP, and employment data. Widely used in financial and economic data pipelines via the fredapi Python library for loading macro data into analytical systems.
The FEC provides access to campaign finance data, including information on political contributions, campaign expenditures, fundraising activities and financial disclosures filed by political candidates, parties and committees in the United States.
Access demographic, economic, social, and geographic datasets from the US Census Bureau including the American Community Survey, decennial census, and economic census. Used in data engineering for population analysis pipelines, market research, geospatial enrichment, and building socioeconomic dashboards in Python.