Compare county industry hiring and earnings in Python

Compare quarterly hiring within local industries, add stable-job turnover and monthly earnings, and use the source quality flags.

Compare hiring and earnings in local industries

You are preparing a county labor-market brief and want to compare recent hiring with the same quarter a year earlier. This example compares professional services and accommodation/food services in Wake County, North Carolina, and health care/social assistance in neighboring Durham County. It adds stable-job turnover and monthly earnings to put the hiring counts in context.

The optional input.csv contains these three real county/industry selections. The identical selections appear in the selections list in the Python code below. The choices are illustrative; all observations come from Census, and no employment values are invented.

county_industry_quarters.csv is a genuine subset of the purchased table: every available 2020–2024 quarter for the three selected county/industry pairs, with all 33 columns unchanged. Download it into your working folder. The $29 full edition contains 1,129,047 observations across 19 broad industries, plus five companion CSVs, dictionaries and validation records. It covers private employment; Alaska is unavailable and Michigan is partial. Review the complete scope and fields.

Code example

This standard-library example runs directly in a notebook, IPython or a script. It compares 2024 Q4 hires with 2023 Q4 and checks each measure’s quality flag before using its value. Comparing the same quarter helps keep the seasonal context consistent; the source data remain unadjusted.

Paths are relative to your working folder; use from pathlib import Path; print(Path.cwd()) to check it, or supply full paths.

Python 3.10+ · Jupyter, IPython or a script
import csv
from decimal import Decimal
from pathlib import Path

# These real county/industry selections also appear in the optional input.csv.
selections = [
    {'county_code': '37183', 'industry_code': '54'},  # Wake: professional services
    {'county_code': '37183', 'industry_code': '72'},  # Wake: accommodation and food
    {'county_code': '37063', 'industry_code': '62'},  # Durham: health and social care
]
wanted = {(r['county_code'], r['industry_code']) for r in selections}
reference = {}
with Path('county_industry_quarters.csv').open(newline='', encoding='utf-8') as file:
    for row in csv.DictReader(file):
        pair = (row['county_code'], row['industry_code'])
        if pair in wanted and row['year'] in {'2023', '2024'} and row['quarter'] == '4':
            key = (*pair, row['year'])
            if key in reference:
                raise ValueError(f'Duplicate county/industry/quarter: {key}')
            reference[key] = row

# These flags indicate released estimates without significant distortion.
# Other released values remain in the file, but are excluded from this comparison.
usable_flags = {'1', '6', '10'}
def usable(row, field):
    return bool(row and row[field] and row[field + '_flag'] in usable_flags)

results = []
for selection in selections:
    pair = (selection['county_code'], selection['industry_code'])
    current = reference.get((*pair, '2024'))
    previous = reference.get((*pair, '2023'))
    result = dict(selection, county_name='', industry_name='', hires='',
                  hires_change_percent='', turnover_percent='', monthly_earnings='',
                  comparison_status='current_row_absent')
    if current:
        result.update(county_name=current['county_name'], industry_name=current['industry_name'],
                      comparison_status='hires_comparison_unavailable')
        if usable(current, 'hires'):
            result['hires'] = current['hires']
            if usable(previous, 'hires') and Decimal(previous['hires']) > 0:
                change = (Decimal(current['hires']) / Decimal(previous['hires']) - 1) * 100
                result['hires_change_percent'] = f'{change:.1f}'
                result['comparison_status'] = 'comparable_released_hires'
        if usable(current, 'stable_turnover_rate'):
            result['turnover_percent'] = f"{Decimal(current['stable_turnover_rate']) * 100:.1f}"
        if usable(current, 'stable_monthly_earnings'):
            result['monthly_earnings'] = current['stable_monthly_earnings']
    results.append(result)
    print(f"{result['county_name'] or pair[0]} / {result['industry_name'] or pair[1]}: "
          f"2024 Q4 hires {result['hires'] or 'n/a'}; "
          f"change from 2023 Q4 {result['hires_change_percent'] or 'n/a'}%; "
          f"stable turnover {result['turnover_percent'] or 'n/a'}%; "
          f"monthly earnings ${result['monthly_earnings'] or 'n/a'}; "
          f"{result['comparison_status']}")

Replace selections with your own county/industry codes, or load those two columns from a CSV. Preserve county codes as five-character text and industry codes as text, including combined sectors such as 31-33. Other selections require the full purchased file.

Analysis of the output

Wake, NC / Professional, Scientific, and Technical Services: 2024 Q4 hires 10977; change from 2023 Q4 -3.4%; stable turnover 7.6%; monthly earnings $11030; comparable_released_hires
Wake, NC / Accommodation and Food Services: 2024 Q4 hires 16189; change from 2023 Q4 -9.1%; stable turnover 15.7%; monthly earnings $2435; comparable_released_hires
Durham, NC / Health Care and Social Assistance: 2024 Q4 hires 3999; change from 2023 Q4 -15.6%; stable turnover 6.2%; monthly earnings $6768; comparable_released_hires

Wake’s accommodation and food services sector reports 16,189 hires in 2024 Q4, compared with 10,977 in professional services. But the industries also differ in stable-job turnover: 15.7% versus 7.6%. Their average monthly earnings for full-quarter jobs are $2,435 and $11,030, respectively. These figures describe different aspects of the local labor market; the largest hiring count alone does not identify the best-paid or most stable work.

Hiring is lower than in 2023 Q4 for all three selected pairs. That is a change in accessions, including recall hires—not a measure of vacant jobs, layoffs or net job growth. It does not establish that local unemployment rose. Durham’s health care and social assistance figure also includes private employers only.

“Stable” means employment with the same employer across the quarter’s two boundaries, not full-time work. Earnings combine full- and part-time jobs and are nominal monthly averages. They should not be interpreted as hourly pay or simply multiplied into an annual salary. The published turnover rate uses stable hires and subsequent stable separations; it cannot be reconstructed from the table’s all-hires and all-separations columns.

The example accepts flags 1, 6 and 10. Suppressed or unavailable cells print as n/a; released values marked for significant distortion are retained in the data but omitted from this comparison. A zero prior hiring count also prevents a percentage calculation. Source noise protection still applies to accepted values, and the percentage changes are descriptive rather than statistical significance tests.

Choose the labor-market measure that fits

State JOLTS supplies statewide job openings and separates quits from layoffs; it does not supply these county/industry cells. QCEW adds workplace job and wage context. County workforce flows describes residence/workplace relationships. Check job populations, periods and geographic vintages before comparing them. Browse the business and labor collection →

Using the full dataset

Extract the purchased ZIP and replace the sample with the full county_industry_quarters.csv. The code runs unchanged. A row is uniquely identified by county, industry, year and quarter. The edition contains seven measures covering private employment, all hires, separations, stable-job turnover and earnings for full-quarter and newly stable jobs.

The source supplies observations for 3,192 county-equivalent codes. The coverage reference accounts for 3,222 codes across all 20 requested quarters. Alaska has no in-period observations; Michigan ends in 2021 Q4, with some measures unavailable near the series end. Puerto Rico is included, and the U.S. Virgin Islands are outside coverage. An absent industry row and a suppressed measure in a present row are different outcomes; neither is filled with zero.

Use county_coverage.csv to find missing sector rows, state_coverage.csv for period and publisher-version evidence, and measure_quality.csv for each measure’s flag counts. source_requests.csv accounts for all 520 data queries and measures.csv defines the selected statistics. Dictionaries, source/processing identities, checksums and the example travel with the download.

Census applies 2025 county geography and 2022 NAICS across this snapshot, including Connecticut planning regions. These are not original historical boundaries or original quarterly releases. Publisher notices also identify reporting changes, including New York transportation and warehousing beginning 2024 Q1; consult those notices before interpreting a sharp trend. Do not sum rates or unweighted earnings averages across sectors or quarters.

Sources and versions

Source: U.S. Census Bureau, LEHD Quarterly Workforce Indicators. The QWI definitions, public-use schema and data notices describe the populations, quality flags and reporting changes.

Observations cover 2020–2024. ACD captured the exact API responses on October 31, 2026. The API does not return a publisher release identifier; the retained state version files describe the contemporaneous public bulk publication. This is one revised source snapshot, not a collection of original quarterly publication vintages.

Your purchase covers this fixed edition, including ACD processing improvements and documented publisher error corrections to it. New periods or genuinely new source editions may be sold separately. Census supplies the original statistics free; ACD sells preparation, documentation, validation and delivery. Read the source and preparation record.

Example checked October 31, 2026 against both these samples and the complete purchased files. Source and processing records, sample checksums · Expected result CSV. Independent preparation; no agency endorsement.