Compare occupational pay across labor markets in Python
Compare employment size, median hourly wages and occupational concentration across three labor markets using prepared BLS OEWS data, a free sample and copyable Python.
Compare pay for the same occupation
Suppose you are preparing a workforce brief for a healthcare business considering three North Carolina labor markets. Compare licensed practical and licensed vocational nurses across Raleigh-Cary, Charlotte-Concord-Gastonia and Durham-Chapel Hill. The reference adds estimated jobs, median hourly wages and the occupation’s share relative to the national economy.
The optional input.csv contains the three selected market codes and occupation code 29-2061. The identical list appears as markets in the Python code below. These are analysis selections, not observations of an employer or hiring plans.
occupation_estimates.csv below is a small, genuine sample of the file you buy: the published detailed-occupation row for each selected market, with every product field unchanged. Save it in your working folder. The complete purchase covers 237,521 occupation-and-area estimates and adds area, occupation and county-membership reference tables.
Code example
This reads only the selected records into the lookup, keeps identifiers as text and prints the comparison. The four-part key includes area type and occupation level so aggregate rows cannot be mistaken for a detailed occupation.
Paths are relative to your working folder; use from pathlib import Path; print(Path.cwd()) to check it, or supply full paths.
"""Compare the same occupation across three labor markets, in a notebook or script."""
import csv
from decimal import Decimal
from pathlib import Path
# Selected comparison markets, also supplied in example_input.csv.
markets = [
{"market": "Raleigh-Cary", "area_code": "39580", "occupation_code": "29-2061"},
{"market": "Charlotte-Concord-Gastonia", "area_code": "16740", "occupation_code": "29-2061"},
{"market": "Durham-Chapel Hill", "area_code": "20500", "occupation_code": "29-2061"},
]
reference_path = Path("occupation_estimates.csv")
needed = {("4", row["area_code"], row["occupation_code"], "detailed") for row in markets}
with reference_path.open(newline="", encoding="utf-8") as file:
reference = {}
for row in csv.DictReader(file):
key = (row["area_type"], row["area_code"], row["occupation_code"], row["occupation_level"])
if key not in needed:
continue
if key in reference:
raise ValueError(f"Duplicate reference key: {key}")
reference[key] = row
results = []
for market in markets:
row = reference.get(("4", market["area_code"], market["occupation_code"], "detailed"))
result = {**market, "occupation": "", "jobs": "", "median_hourly_usd": "", "location_quotient": "", "status": "not_in_reference"}
if row is not None:
result["occupation"] = row["occupation_title"]
selected = {"jobs": "employment", "median_hourly_usd": "hourly_median", "location_quotient": "location_quotient"}
notes = []
for output, field in selected.items():
if row[field + "_status"] == "reported":
value = Decimal(row[field])
result[output] = f"{value:,.0f}" if output == "jobs" else f"{value:.2f}"
else:
notes.append(field + ": " + row[field + "_status"])
result["status"] = "; ".join(notes) if notes else "reported"
results.append(result)
print(f'{result["market"]} | {result["occupation"] or "No published row"} | jobs {result["jobs"] or "—"} | median $/hour {result["median_hourly_usd"] or "—"} | location quotient {result["location_quotient"] or "—"} | {result["status"]}')
Analysis of the output
Raleigh-Cary | Licensed Practical and Licensed Vocational Nurses | jobs 1,740 | median $/hour 30.81 | location quotient 0.56 | reported
Charlotte-Concord-Gastonia | Licensed Practical and Licensed Vocational Nurses | jobs 3,890 | median $/hour 31.32 | location quotient 0.69 | reported
Durham-Chapel Hill | Licensed Practical and Licensed Vocational Nurses | jobs 960 | median $/hour 32.19 | location quotient 0.67 | reported
Durham-Chapel Hill has the highest published median hourly wage of the three, at $32.19. Charlotte-Concord-Gastonia has the largest estimated employment count, at 3,890 jobs. Those figures describe different aspects of the market: a larger workforce does not imply a higher median wage.
The location quotients are below 1 in all three areas. Licensed practical/vocational nursing accounts for a smaller share of each area’s employment than its national share. A location quotient measures concentration; it does not establish a shortage, open vacancies or recruitment difficulty.
These are May 2025 estimates, not current offers. Employment counts wage-and-salary jobs, rounded to ten; the median is a wage distribution statistic. The product also supplies mean wages, percentiles and precision measures. Its mean-wage PRSE does not provide a confidence interval for the median, so this example does not claim statistically significant differences.
The code shows a status instead of inventing a value when a measure is unavailable or only a threshold is published. An absent row is also distinct from zero employment. With the full file, check the relevant status before ranking or averaging estimates.
Using the full dataset
Replace the sample with occupation_estimates.csv from the purchased ZIP and run the same code. Change markets to your selected area/occupation codes, or load your CSV into that list using csv.DictReader. Use areas.csv and occupations.csv to find the available identifiers and labels. Other area types require changing the "4" metropolitan filter in both lookup-key locations.
If your starting point is a county FIPS code, area_counties.csv identifies its official May 2025 labor-market area. The resulting wage and employment values describe that entire region. They are not county estimates, and must not be added once per member county. Charlotte’s area also includes South Carolina; primary_state is not a boundary definition.
Keep occupation levels separate: total, major, minor, broad and detailed categories overlap. Some detailed OEWS categories combine SOC occupations. This cross-industry product does not tell you how many nurses work specifically in nursing homes. For industry jobs or resident unemployment, consult the labor-market dataset comparison.
Sources and versions
Source: BLS Occupational Employment and Wage Statistics, May 2025, published May 15, 2026. ACD retained the original national, state and regional archives plus official area definitions on October 21, 2026. The package was prepared 2026-10-21. Source edition, acquisition and ACD processing are separately recorded.
The BLS technical notes describe the six panels combined into this single reference period, the wage definitions and the excluded employment categories. This product contains one reference period, not a historical series. Original BLS data are free; the purchase provides prepared tables, documentation, validation 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.