Adjust hourly earnings for inflation in Python
Use national CPI-U to compare actual manufacturing and professional/business hourly earnings in December 2025 dollars.
For a category comparison, read which consumer prices rose most from 2015 to 2025.
Compare earnings in the same month’s dollars
For an annual overview, see the 2016–2025 CPI history table and free CSV. This worked example uses monthly readings to compare earnings at specific dates.
A rise in hourly pay does not tell you how much purchasing power changed. This example converts actual manufacturing and professional/business services earnings in December 2019, December 2020 and December 2025 into December 2025 dollars, using the national, unadjusted all-items Consumer Price Index for All Urban Consumers (CPI-U).
The optional input.csv contains six genuine Bureau of Labor Statistics Current Employment Statistics (CES) hourly earnings observations. The same amounts appear in the selections list in the Python code below. These are unadjusted, current-dollar earnings from our industry employment edition, whose source was captured November 4, 2026. You do not need to buy that product to run this example; its six selected earnings amounts are provided here.
Download monthly_observations.csv into your working folder. It is a genuine subset of the paid CPI table: national all-items CPI-U for every month of 2019, 2020 and 2025, with all 25 columns. October 2025 retains its missing source reading. The full $29 download contains 267,212 monthly rows across 397 categories, plus annual averages, series definitions, coverage and provenance tables. Inspect the full coverage and fields.
Code example
The code uses Python’s standard library and runs in a notebook cell, IPython or a script. It selects CUUR0000SA0, the unadjusted national all-items CPI-U, then calculates nominal amount × December 2025 index ÷ observation-month index. Both the earnings inputs and price index are unadjusted. Replace selections with your own dated dollar amounts to apply the same method.
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
# Genuine CES hourly earnings: the same six rows are supplied in input.csv.
# Replace this list with your own dated dollar amounts when using the full data.
selections = [
{'industry': 'Manufacturing', 'month': '2019-12', 'hourly_usd': '28.26'},
{'industry': 'Manufacturing', 'month': '2020-12', 'hourly_usd': '29.05'},
{'industry': 'Manufacturing', 'month': '2025-12', 'hourly_usd': '36.09'},
{'industry': 'Professional and business services', 'month': '2019-12', 'hourly_usd': '34.55'},
{'industry': 'Professional and business services', 'month': '2020-12', 'hourly_usd': '35.39'},
{'industry': 'Professional and business services', 'month': '2025-12', 'hourly_usd': '44.87'},
]
base_month = '2025-12'
cpi = {}
with open('monthly_observations.csv', newline='', encoding='utf-8') as file:
for row in csv.DictReader(file):
if row['series_id'] == 'CUUR0000SA0': # National all-items CPI-U, unadjusted.
if row['month'] in cpi:
raise ValueError('Duplicate CPI month')
cpi[row['month']] = row['value']
if not cpi.get(base_month):
raise ValueError('The base month needs a published CPI value')
base_index = Decimal(cpi[base_month])
results = []
for item in selections:
value = cpi.get(item['month'])
real = '' if not value else f"{Decimal(item['hourly_usd']) * base_index / Decimal(value):.2f}"
results.append({**item, 'cpi': value or '', 'hourly_usd_dec2025': real,
'status': 'converted' if value else 'cpi_unavailable'})
for row in results:
if row['status'] != 'converted':
print(f"{row['industry']} | {row['month']} | CPI unavailable")
else:
print(f"{row['industry']} | {row['month']} | ${row['hourly_usd']}/hour nominal | "
f"${row['hourly_usd_dec2025']}/hour in December 2025 dollars")
Analysis of the output
Manufacturing | 2019-12 | $28.26/hour nominal | $35.64/hour in December 2025 dollars
Manufacturing | 2020-12 | $29.05/hour nominal | $36.14/hour in December 2025 dollars
Manufacturing | 2025-12 | $36.09/hour nominal | $36.09/hour in December 2025 dollars
Professional and business services | 2019-12 | $34.55/hour nominal | $43.57/hour in December 2025 dollars
Professional and business services | 2020-12 | $35.39/hour nominal | $44.03/hour in December 2025 dollars
Professional and business services | 2025-12 | $44.87/hour nominal | $44.87/hour in December 2025 dollars
Manufacturing’s nominal hourly earnings rise from $28.26 in December 2019 to $36.09 in December 2025. In December 2025 purchasing power, however, the 2019 amount is about $35.64. The comparison therefore shows a much smaller increase after accounting for consumer-price changes. Professional and business services rises from an inflation-adjusted $43.57 in December 2019 to $44.87 in December 2025.
The result is a comparison of average earnings and national consumer purchasing power. It is not the pay history of the same workers: changes in the mix of jobs can also move average earnings. National CPI-U is not a household-specific budget or a measure of local price differences. The reference period here is December 2025, not the average of calendar year 2025.
The code keeps an input visible as cpi_unavailable when its month lacks a usable CPI value, and stops if the reference month is missing or a selected CPI month is duplicated. It does not invent a conversion for October 2025. In the delivered table, raw_value, availability and footnote_codes explain the missing reading.
Choose a price index for your question
The all-items index is useful for general consumer purchasing-power comparisons. Category series support questions about food, shelter, transportation and other consumer-price trends, but their index levels are not comparable dollar prices. An index of 300 for one category and 200 for another does not mean the first category costs 50% more. Compare change within the same series, keeping its base period and adjustment choice.
Choose related business and labor data → · Compare industry employment, hours and earnings →
Using the full dataset
Extract the purchased ZIP and replace the sample with the complete monthly_observations.csv. The code runs unchanged. The full table includes 723 original national CPI-U series across 397 categories, with observations between January 1990 and December 2025 where available. The key is series_id + year + period; preserve the original IDs as text.
series.csv provides adjustment choices, category labels, reference bases and source start/end periods. categories.csv retains category names and hierarchy fields. Categories overlap and are not additive. coverage.csv distinguishes numeric readings, explicit source-missing readings and months absent from a series. Some series begin later, end earlier or lack one adjustment choice.
The monthly table includes ACD-calculated same-series month and year percentage changes. Missing current or comparison readings produce blank changes and explicit statuses. These calculations use delivered index precision and may differ from separately published BLS percent changes.
annual_observations.csv retains 12,433 published unadjusted annual averages. Affected 2025 averages use 11 available months because of the October shutdown; reported_months records the count. Annual averages remain separate from monthly readings. source_accounting.csv accounts for every original data row, and observation_sources.csv preserves the relationships to original file positions, including exact duplicates shared by source partitions.
Sources and versions
Source: BLS CPI-U bulk files, captured November 5, 2026. The observation files were last modified October 19. This product contains revised history through December 2025, not original-as-published monthly vintages or a live feed. It includes standard-base monthly U.S. city-average CPI-U series, excluding regional indexes, CPI-W, chained CPI and the inverse purchasing-power series.
BLS explains the CPI’s scope, seasonal adjustment and October 2025 shutdown’s effect on observations and annual averages. No missing price values have been interpolated.
Your one-time purchase includes processing improvements and documented publisher error corrections to this edition. New periods or genuinely new source editions may be sold separately; routine statistical revisions are not automatically error corrections. There is no membership or automatic-refresh promise. The BLS source data are free; ACD sells preparation, documentation, validation and delivery. Read the preparation record.
Example checked November 5, 2026 against both these samples and the complete purchased files. Source and processing records, sample checksums · Expected result CSV. Independent preparation; no agency endorsement.