Compare county labor markets in Python
Add labor-force size and unemployment trends to a county market comparison using eleven years of prepared BLS history, a free sample and copyable Python.
Add labor-market context to a county comparison
Suppose you are preparing a market brief for three counties. You want to describe the local labor force, see whether unemployment increased, and show the latest available estimate. The product supplies annual resident employment and unemployment from 2015 through 2025, so you can compare years without assembling eleven BLS spreadsheets.
The optional input.csv contains fictional market labels paired with real county codes for Wake, Maricopa and San Juan. These same records appear in the markets list in the Python code below. Only the market labels are invented; the county estimates are genuine selections from the product.
Download the product sample
Save county_years.csv in your working folder. It contains all eleven annual records for each selected county, with every field from the purchased file. The full $29 download contains 35,426 county/year records and three companion tables for coverage, periods and source-row accounting.
The example compares the full annual averages for 2023 and 2024. It then shows 2025 separately: outside Puerto Rico, BLS omitted October because data were not collected during the federal shutdown. That eleven-month average is not fully comparable to an ordinary annual average.
Code example
The code keeps county identifiers as text and looks up one record per county and year. It adds labor-force size, the unemployment rate, the 2023–2024 change in percentage points, and the latest estimate with its coverage label. The results list remains available in your notebook.
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 decimal import Decimal
from pathlib import Path
# The optional input.csv contains this same fictional market shortlist.
# County codes and the reference estimates are real.
markets = [
{"market": "Triangle", "county_fips": "37183"},
{"market": "Central Arizona", "county_fips": "04013"},
{"market": "San Juan", "county_fips": "72127"},
]
with Path("county_years.csv").open(newline="", encoding="utf-8") as stream:
history = {(r["county_fips"], r["year"]): r for r in csv.DictReader(stream)}
results = []
for market in markets:
before = history.get((market["county_fips"], "2023"))
after = history.get((market["county_fips"], "2024"))
latest = history.get((market["county_fips"], "2025"))
result = {**market, "county": "", "labor_force_2024": "",
"unemployment_2024_pct": "", "change_2023_2024_pp": "",
"unemployment_2025_pct": "", "months_2025": "", "comparison": "not_available"}
if after:
result.update(county=after["county_name"], labor_force_2024=after["labor_force"],
unemployment_2024_pct=after["unemployment_rate_pct"])
if before and after and all(r["estimate_status"] == "reported" and
r["period_status"] == "annual_12_months" for r in (before, after)):
difference = Decimal(after["unemployment_rate_pct"]) - Decimal(before["unemployment_rate_pct"])
result["change_2023_2024_pp"] = f"{difference:+.1f}"
if latest:
result.update(unemployment_2025_pct=latest["unemployment_rate_pct"],
months_2025=latest["months_in_average"])
if latest["estimate_status"] == "reported":
result["comparison"] = ("11-month average; October omitted" if latest["months_in_average"] == "11"
else "12-month annual average")
results.append(result)
for r in results:
print(f'{r["market"]} | {r["county"]} | 2024 labor force: {r["labor_force_2024"] or "unavailable"} '
f'| unemployment: {r["unemployment_2024_pct"] or "unavailable"}% '
f'| 2023–24: {r["change_2023_2024_pp"] or "unavailable"} pp '
f'| 2025: {r["unemployment_2025_pct"] or "unavailable"}% ({r["comparison"]})')
Analysis of the output
Triangle | Wake County, NC | 2024 labor force: 682623 | unemployment: 3.2% | 2023–24: +0.2 pp | 2025: 3.2% (11-month average; October omitted)
Central Arizona | Maricopa County, AZ | 2024 labor force: 2479847 | unemployment: 3.2% | 2023–24: +0.0 pp | 2025: 3.8% (11-month average; October omitted)
San Juan | San Juan Municipio, PR | 2024 labor force: 142275 | unemployment: 3.9% | 2023–24: -0.6 pp | 2025: 3.5% (12-month annual average)
Wake and Maricopa both had a 3.2% unemployment rate in 2024, but their labor forces differed substantially: about 683,000 people in Wake and 2.48 million in Maricopa. The rate describes unemployed people as a share of the labor force; the count provides a separate measure of local scale.
Wake’s published rate increased 0.2 percentage points from 2023 to 2024, while Maricopa’s was unchanged at the source’s one-decimal precision. San Juan’s rate fell 0.6 percentage points to 3.9%. These are descriptive differences, not a statistical-significance test or an explanation of why conditions changed.
The 2025 column shows 3.2% for Wake and 3.8% for Maricopa, both based on eleven months. San Juan’s 3.5% uses twelve months. The code deliberately does not calculate a common 2024–2025 growth measure across these different periods.
LAUS employment counts residents, each once even if they hold multiple jobs. It is different from jobs at local establishments in QCEW. Unemployment also has a specific BLS definition involving availability and job search or temporary layoff; it does not count everyone without a job.
Using the full dataset
Extract the purchased ZIP and replace the sample with the complete county_years.csv. Replace the markets list with your own records, or load a CSV with market and county_fips columns:
with open("my_counties.csv", newline="", encoding="utf-8-sig") as stream:
markets = list(csv.DictReader(stream))
For a trend chart, select a county and plot year against unemployment_rate_pct or labor_force. Keep estimate_status and period_status with those values. All 78 Puerto Rico municipios have unavailable estimates for 2020; those rows remain in the file with blank measures, not zeros.
county_coverage.csv lists each code’s observed years. Connecticut’s nine planning regions are carried back by BLS. Alaska code 02261 appears through 2019; codes 02063 and 02066 begin in 2020. Do not splice those records into one county history without a separately justified geographic method. A shared FIPS code also does not prove identical boundaries across different data products.
The County Population & Migration History adds population context; CPS Labor Force Microdata supports national demographic analysis. These have different statistical populations and periods. Dividing LAUS labor force by total county population does not produce the standard labor-force participation rate.
Sources and versions
Source: BLS Local Area Unemployment Statistics annual county workbooks. ACD captured the 2015–2025 files on October 21, 2026. The 2015 workbook is dated April 18, 2025; the remaining files are dated May 19, 2026. ACD packaged this preparation 2026-10-21.
This is one retained capture of BLS’s revised annual history, not the original as-published vintage for each year. A later publisher revision may change older estimates. Our processing revisions are tracked separately, and improvements using these retained inputs are included for buyers.
Independent acceptance compares all four prepared tables directly with the original spreadsheet XML. The pipeline retains typed source cells and checks identifiers, uniqueness, labor-force balances, rate arithmetic, period labels and every source row. These checks validate preparation; they do not eliminate uncertainty in the underlying estimates.
BLS concepts and methods · Source and preparation record. Original government data are freely available; ACD charges for preparation, validation, documentation and delivery.
Example checked October 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.