COUNTY BUSINESS PATTERNS / PYTHON + CSV
Compare county business activity in Python
Add establishment counts, employment and payroll to sales territories using county FIPS and 2017 NAICS codes.
Compare business activity across sales territories
A dental-equipment supplier is comparing three North Carolina counties. County Business Patterns adds a consistent measure of the local employer base: establishments, employment and payroll for Offices of Dentists (2017 NAICS 621210). These can inform a territory review alongside the supplier’s own customer and sales data.
The optional territory input CSV contains fictional territory labels paired with real county and industry identifiers. The same records appear in the territories list in the Python code below. The sales scenario is invented; the business statistics are not.
county_industry.csv below is a three-record selection from the paid dataset, with all 14 columns unchanged. Save it in your working folder. The complete download contains 353,065 county/industry records, plus county totals, establishment size bands, reference tables and source documentation.
Code example
The join uses the county FIPS and 2017 NAICS code together. Both stay as text. The example reads only the requested keys into memory and converts payroll from thousands of dollars for display.
Paths are relative to your working folder; use from pathlib import Path; print(Path.cwd()) to check it, or supply full paths.
import csv
# Fictional sales territories; the county/industry identifiers are real.
territories = [
{'territory': 'Chatham', 'county_fips': '37037', 'naics_code': '621210'},
{'territory': 'Durham', 'county_fips': '37063', 'naics_code': '621210'},
{'territory': 'Wake', 'county_fips': '37183', 'naics_code': '621210'},
]
wanted = {(r['county_fips'], r['naics_code']) for r in territories}
with open('county_industry.csv', newline='', encoding='utf-8') as file:
reference = {(r['county_fips'], r['naics_code']): r
for r in csv.DictReader(file)
if (r['county_fips'], r['naics_code']) in wanted}
results = []
for territory in territories:
match = reference.get((territory['county_fips'], territory['naics_code']))
results.append({**territory,
'industry_name': match['industry_name'] if match else '',
'establishments': match['establishments'] if match else '',
'employees_mid_march': match['employees_mid_march'] if match else '',
'annual_payroll_thousand_usd': match['annual_payroll_thousand_usd'] if match else '',
'annual_payroll_noise_flag': match['annual_payroll_noise_flag'] if match else '',
'status': 'published' if match else 'not_in_reference',
})
for row in results:
if row['status'] == 'published':
print(f"{row['territory']}: {row['establishments']} establishments | "
f"{row['employees_mid_march']} employees | "
f"annual payroll ${int(row['annual_payroll_thousand_usd']) * 1000:,} "
f"(noise flag {row['annual_payroll_noise_flag']})")
else:
print(f"{row['territory']}: no row in the supplied reference; do not assume zero.")
Analysis of the output
Chatham: 22 establishments | 137 employees | annual payroll $7,839,000 (noise flag G)
Durham: 141 establishments | 1012 employees | annual payroll $71,533,000 (noise flag G)
Wake: 562 establishments | 5117 employees | annual payroll $375,924,000 (noise flag G)
In the 2023 source, Wake has 562 employer establishments in this industry, Durham 141 and Chatham 22. These are operating locations, not counts of dentists, separate firms or named prospects. Employment and payroll add context about each county’s industry scale; they are not revenue or demand estimates.
The annual payroll field is in thousands of nominal 2023 dollars. The displayed amounts multiply it by 1,000. Employment refers to the pay period including March 12, 2023. Payroll and employment are noise perturbed: G means less than 2%, H means 2% to less than 5%, and J means at least 5%. These flags are not margins of error.
If you replace the example keys and get not_in_reference, first check that you are using the complete file and compatible identifiers. Even in the full file, an absent county/industry combination is not a reported zero. The reference tables help identify known counties and industries without published observations.
Using the full dataset
After purchase, extract the ZIP and point open('county_industry.csv', ...) at its main file. Replace the territories list with your county/industry records, or load your own CSV using csv.DictReader. The code works unchanged for these three records in the full file.
county_totals.csvcontains the separately published all-industry totals. Use those when you need a county total; summing disclosed detail rows can undercount.establishment_sizes.csvjoins on the same county/industry pair and adds 13 size bands. Source N becomes a blank analytical count with an explicit status; published zeros stay zero. The 1,000-plus band overlaps its four sub-bands.counties.csvandindustries.csvsupply names and coverage indicators for the full reference universe.statewide_source_rows.csvpreserves county-code 999 records separately. These are activity unassigned to counties, not state totals.
The NAICS crosswalk can help review how these 2017 industries relate to 2022 codes. It does not provide weights for moving business statistics between classifications. The ACS county profile adds demographic context from 2020–2024; compare periods and geographic boundaries before constructing rates.
Sources and versions
Statistics: 2023 County Business Patterns, released by Census on June 26, 2025. Industry classification: 2017 NAICS. County reference: georef22 (2022–2023), including Connecticut’s planning regions. ACD prepared this package on 2026-10-16; that is not a new Census reference year.
Includes the 50 states and DC, without Puerto Rico or island areas. CBP covers employer establishments, excluding businesses without paid employees and other activities outside its scope. Consult Census methodology for coverage and disclosure details and the 2023 source files for the free original data.
Initial release and preparation record · How source editions and processing revisions are tracked.
Example checked October 16, 2026 against both these samples and the complete purchased files. Source and processing records, sample checksums · Expected result CSV. Independent preparation; no agency endorsement.