Compare state gross job gains and losses in Python

Compare gross private-sector job gains and losses behind net change in North Carolina, Georgia and Virginia using genuine BLS BED data.

A state can add jobs overall while businesses shed a substantial number of positions. For a regional market brief, the gross gains and losses show the activity behind that net change. This example compares North Carolina, Georgia and Virginia in the fourth quarter of 2025 using BLS Business Employment Dynamics (BED).

Sample data

state_observations.csv is a genuine subset of the paid table: all 64 component/measure/statistic/adjustment combinations for each of the three states in Q4 2025, with all 27 columns unchanged. The code selects seasonally adjusted employment gains and losses. Establishment counts, components and unavailable death estimates remain in the sample for inspection.

The optional input.csv contains the actual state codes and short labels selected for the comparison. Those same selections appear in the places list in the Python code below. No employment observations are invented.

Save the sample as state_observations.csv in your working folder.

Code example

Select one quarter and adjustment, employment rather than establishments, and the two gross-flow totals. The code checks for missing or duplicate observations and keeps levels in jobs and rates in percent. It runs in a notebook, IPython or a script using standard Python.

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 actual state codes are also listed in the optional example_input.csv.
places = [
    {'state_code': '37', 'label': 'North Carolina'},
    {'state_code': '13', 'label': 'Georgia'},
    {'state_code': '51', 'label': 'Virginia'},
]
quarter = '2025-Q4'
path = Path('state_observations.csv')
wanted = {p['state_code'] for p in places}
observations = {}
with path.open(newline='', encoding='utf-8') as stream:
    for row in csv.DictReader(stream):
        if (row['state_code'] in wanted and row['quarter'] == quarter
                and row['seasonal'] == 'S' and row['measure_code'] == '1'
                and row['component_code'] in {'01', '04'}):
            key = (row['state_code'], row['component_code'], row['statistic'])
            if key in observations:
                raise ValueError(f'Duplicate observation: {key}')
            if row['availability'] != 'reported':
                raise ValueError(f'Required estimate is unavailable: {key}')
            observations[key] = row

def value(state, component, statistic):
    key = (state, component, statistic)
    if key not in observations:
        raise ValueError(f'Missing required observation: {key}')
    row = observations[key]
    if row['unit'] != ('jobs' if statistic == 'L' else 'percent'):
        raise ValueError(f'Unexpected unit: {key}')
    return Decimal(row['value'])

results = []
for place in places:
    state = place['state_code']
    gains, losses = value(state, '01', 'L'), value(state, '04', 'L')
    gain_rate, loss_rate = value(state, '01', 'R'), value(state, '04', 'R')
    results.append({
        'state_code': state, 'state': place['label'], 'quarter': quarter,
        'jobs_gained': str(gains), 'jobs_lost': str(losses),
        'net_job_change': str(gains - losses),
        'gross_gain_rate_percent': str(gain_rate),
        'gross_loss_rate_percent': str(loss_rate),
        'net_rate_from_rounded_components_pp': str(gain_rate - loss_rate),
    })
    print(f"{place['label']}: {gains:,.0f} jobs gained, {losses:,.0f} lost; "
          f"net {gains-losses:+,.0f}. Rates: {gain_rate:.1f}% gained, {loss_rate:.1f}% lost.")

Analysis of the output

North Carolina: 253,017 jobs gained, 213,191 lost; net +39,826. Rates: 6.0% gained, 5.0% lost.
Georgia: 248,511 jobs gained, 227,063 lost; net +21,448. Rates: 5.9% gained, 5.4% lost.
Virginia: 197,261 jobs gained, 176,003 lost; net +21,258. Rates: 5.8% gained, 5.2% lost.

North Carolina records 253,017 jobs gained and 213,191 lost, yielding a net increase of 39,826. Georgia's net increase is 21,448, and Virginia's is 21,258. These are changes at private establishments between the third months of adjacent quarters, not counts of every worker hired or separated during the quarter.

The published gross gain and loss rates provide scale context. North Carolina's rates are 6.0% and 5.0%, versus Georgia's 5.9% and 5.4%. Their denominator is the average of employment in the current and previous quarters. Subtracting the displayed rates gives an approximate net rate because the components are rounded; it need not reproduce a separately published net-growth rate exactly.

A regional analyst could use these measures alongside employment levels to describe the size of gross flows behind growth. This three-state comparison is not a national ranking, a significance test, evidence of causation or a prediction.

Using the full dataset

Replace the sample with state_observations.csv from the purchased archive. Change places using states.csv and choose another quarter. Review coverage.csv: most series begin in Q3 1992, but DC starts in Q1 2000. The separate national_observations.csv uses code 00 and must not be added to state rows.

Breaking gains and losses into components

Gross gains combine expansions (02) and openings (03); gross losses combine contractions (05) and closings (06). Births (07) are a subset of openings, and deaths (08) are a subset of closings. An opening can be a seasonal reopening. An establishment is a workplace, not necessarily a whole firm. Select the components you need instead of summing every row.

For the number of establishments experiencing each change, select measure_code == '2'. Levels then count establishments, and rates are shares of total establishments. They do not measure jobs. National source levels are published in thousands; ACD converts them to units and retains source_value and source_unit. This does not add precision.

Unavailable values and comparisons

The source's missing dashes are blank in value with availability == 'source_unavailable'. Birth estimates are unavailable before Q2 1993, and death estimates end in Q2 2025 in this snapshot. BLS waits three quarters to establish whether a closing is permanent, so the Q3/Q4 2025 death cells are unavailable even though other measures are reported. Do not replace those blanks with zero.

year_change compares the same original series with the same quarter a year earlier. Rate changes are percentage points. Filter adjustment, component, measure and statistic before joining by state and quarter; a state-only join multiplies rows. Do not average or sum rates across states, or combine adjusted and unadjusted versions.

The separately purchased State JOLTS History describes monthly job openings, hires and separations. State Industry Employment describes payroll levels, hours and pay. County Business Dynamics provides annual Census business statistics. These support different questions; a matching state code does not make the populations or time concepts interchangeable. Browse the businesses and labor collection for those alternatives.

Sources and versions

Source: BLS Business Employment Dynamics, using its original bulk files, modified October 28, 2026 and retained November 21. This ACD edition stops at Q4 2025 and excludes partial 2026. It is one revised-history snapshot, not the values as first published each quarter.

BED primarily covers private establishments subject to unemployment insurance. It excludes government and self-employment and does not count unemployed residents. Historical revisions, source administrative events and seasonal adjustment affect comparisons. The original footnotes remain in the files. See the BLS technical notes and edition and preparation notes.

Original BLS data are free. ACD sells preparation, documentation and validation. Processing improvements and documented publisher error corrections to this edition are included; new periods and source editions may be sold separately.

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