Check the Setup
- Python 3.10 or newer
- A notebook environment such as Jupyter or Google Colab
- An internet connection
Cycle-based examination, laboratory, and questionnaire files for building nutrition and health-survey prototypes from public NHANES tables.
Report a ProblemFrom Source to Product Signal
NHANES public files include demographics, examination, and lab tables by cycle. Start with one cycle's demographics XPT. Unweighted row counts are not national estimates; use interview weights, and do not treat a cycle extract as clinical diagnosis data.
Install the packages, then run the notebook cell.
python -m pip install pandas pyreadstat requests
import pandas as pd
import pyreadstat
import requests
from io import BytesIO
response = requests.get(
"https://wwwn.cdc.gov/Nchs/Nhanes/2021-2023/DEMO_L.xpt",
timeout=60,
)
response.raise_for_status()
demographics, _meta = pyreadstat.read_xport(BytesIO(response.content))
print(demographics.head())Test a Useful Signal
Test whether a public cycle file can power a bounded survey-profile sketch.
National Center for Health Statistics is a government source. Last verified 2026-08-18. Temporal coverage: NHANES cycles from 1999-present with two-year public files.