COUNTY HEALTH INSURANCE / PYTHON + CSV
Compare county health insurance coverage in Python
Add uninsured counts, rates and published margins of error to a county service-area list using prepared Census SAHIE data.
Compare insurance coverage across a service territory
Suppose you are researching three counties for an outreach program. You need both the estimated number of uninsured residents and their share of the population, with uncertainty visible. A county with a lower uninsured rate can still have more uninsured people because its population is larger.
The optional input.csv contains fictional territory labels paired with real FIPS codes for Durham, Guilford and Wake counties in North Carolina. The same records appear in the territories list in the Python code below. The labels represent your internal project names; the insurance estimates are genuine records from the product.
Download the product samples
county_summary.csv is the file used by this example: three county rows selected from the paid download, with the same columns. Its population is people under 65, both sexes, all races and all income levels. Save it in your working folder. The optional county_detail.csv sample contains all 114 demographic combinations for each of those counties, so you can inspect the age, sex and income breakdowns available in the full product.
The complete $29 edition contains 3,144 county/equivalent identifiers and 358,416 detailed rows. Summary estimates are available for 3,143 counties; Kalawao County, Hawaii, is explicitly missing under Census guidance. Inspect the fields and coverage.
Code example
The code checks that the reference is the 2024 under-65 summary, then joins one row to each territory using county FIPS as text. It keeps the published 90% margins of error alongside the estimates and preserves unmatched or unavailable results.
Paths are relative to your working folder; use from pathlib import Path; print(Path.cwd()) to check it, or supply full paths.
import csv
from pathlib import Path
# Fictional outreach territories, paired with real county identifiers.
territories = [
{'territory': 'Triangle west', 'county_fips': '37063'},
{'territory': 'Triad', 'county_fips': '37081'},
{'territory': 'Triangle east', 'county_fips': '37183'},
]
reference_file = Path('county_summary.csv')
with reference_file.open(newline='', encoding='utf-8-sig') as source:
reference = {}
for row in csv.DictReader(source):
if (row['year'], row['age_label'], row['sex_label'], row['income_label']) != (
'2024', 'Under 65 years', 'Both sexes', 'All income levels'
):
raise ValueError('Expected the 2024 under-65 county summary')
if row['county_fips'] in reference:
raise ValueError('Duplicate county in reference')
reference[row['county_fips']] = row
results = []
for item in territories:
match = reference.get(item['county_fips'])
result = {**item, 'county_name': '', 'uninsured_people': '',
'uninsured_people_moe_90': '', 'uninsured_pct': '',
'uninsured_pct_moe_90': '', 'status': 'county_not_in_reference'}
if match:
result.update(county_name=match['county_name'],
uninsured_people=match['uninsured'],
uninsured_people_moe_90=match['uninsured_moe_90'],
uninsured_pct=match['uninsured_pct'],
uninsured_pct_moe_90=match['uninsured_pct_moe_90'],
status=match['uninsured_pct_status'])
results.append(result)
if result['status'] == 'published':
print(f"{result['territory']} | {result['county_name']}: "
f"{int(result['uninsured_people']):,} uninsured (+/- "
f"{int(result['uninsured_people_moe_90']):,}); "
f"{result['uninsured_pct']}% (+/- "
f"{result['uninsured_pct_moe_90']} percentage points)")
else:
print(f"{result['territory']} | {result['county_fips']}: {result['status']}")
Analysis of the output
Triangle west | Durham County: 28,017 uninsured (+/- 2,395); 10.1% (+/- 0.9 percentage points)
Triad | Guilford County: 43,932 uninsured (+/- 3,320); 10.1% (+/- 0.8 percentage points)
Triangle east | Wake County: 75,606 uninsured (+/- 5,032); 7.2% (+/- 0.5 percentage points)
Wake County has an estimated 75,606 uninsured people in this population, compared with 43,932 in Guilford and 28,017 in Durham. Its uninsured percentage, 7.2%, is lower than the 10.1% reported for the other two counties. Counts describe the potential scale of an outreach population; percentages describe the prevalence of being uninsured. The two measures support different planning questions.
The values after +/- are published 90% margins of error. For example, Wake’s 7.2% rate has a 0.5-percentage-point margin, giving an approximate 6.7%–7.7% interval. These are model-based annual estimates for the poverty universe, not a list of people eligible for a particular program. A point-estimate difference alone does not establish statistical significance.
Published zero values are retained. A missing result stays blank with an explicit status; it is not counted as zero uninsured people. Census notes that a zero margin of error means less than one person or less than 0.1 percentage point, rather than perfect certainty.
Using the full dataset
Extract the purchased ZIP and replace the sample with the complete county_summary.csv. The filename and columns stay the same. Replace territories with your own list, or load a CSV with territory and county_fips columns:
with open("my_counties.csv", newline="", encoding="utf-8-sig") as file:
territories = list(csv.DictReader(file))
For a narrower population, use county_detail.csv and categories.csv. Select one age, sex and income code before joining: the categories overlap, and adding all rows would count people repeatedly. Children under 19 have both-sex estimates only. County race/ethnicity breakdowns are not included in SAHIE.
uninsured_pct uses the population within the selected income group. uninsured_pct_all_incomes uses the same age/sex population at all income levels instead. These are different denominators; choose the field that answers your question.
The county identifiers agree with the 50-state/DC subset of our 2020–2024 ACS county profile, including Connecticut’s nine planning regions. The ACS product can add population, income and housing context, but its five-year estimates have different reference periods and universes. This product excludes Puerto Rico and does not supply a hospital-to-county mapping.
Sources and versions
Source: U.S. Census Bureau, 2024 Small Area Health Insurance Estimates, released August 6, 2026. Census’s interpretation and comparison guidance explains the estimates and their uncertainty. The original data are available free.
ACD captured the source October 17, 2026 and prepared this download 2026-10-17. Our preparation creates explicit summary/detail tables, readable categories, blank-safe values and source accounting. The raw data, extraction and processing are retained separately. This is the first ACD edition, with no historical comparison claimed. See the source and preparation record.
Example checked October 17, 2026 against both these samples and the complete purchased files. Source and processing records, sample checksums · Expected result CSV. Independent preparation; no agency endorsement.