cpi
Quickly adjust U.S. dollars for inflation using the Consumer Price Index (CPI)
What it is and what it does
CPI is a Python library for converting U.S. dollar amounts between different years using the Consumer Price Index, accounting for inflation. It lets you answer questions about what a dollar amount from one year is worth in another year by applying official CPI data to your calculations.
The package wraps CPI data into a simple API backed by requests, click, python-dateutil, and pandas. It's designed for quick, straightforward inflation adjustments in data analysis, financial reporting, or historical comparisons without needing to manually source or parse CPI tables yourself.
Use it for:
- Normalize historical salary or wage data to a common year for fair comparison across time periods
- Convert historical prices or costs to present-day equivalents for financial analysis or reporting
- Adjust historical budget figures or grant amounts to account for inflation when planning projects
- Build data pipelines that automatically inflation-adjust time-series economic data for analysis
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adjusts U.S. dollar amounts for inflation using the Consumer Price Index, converting values to a target year's equivalent purchasing power.
Yes. The package is actively maintained, has no known vulnerabilities, uses permissive MIT licensing, and installs with low friction. It solves a common data-wrangling task (inflation adjustment) with a clean API. Install it if you regularly work with historical U.S. financial data or need to normalize dollar amounts across years.
Install
cpi on PyPI
pip
pip install cpiuv
uv add cpipoetry
poetry add cpiInstalling cpi
Before you install
Low install friction with a pure-Python wheel and four common dependencies. Active maintenance with a recent commit on 2026-05-19 and stable production status.
License in practice
MIT license is permissive, allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install cpi
import cpi
# Adjust dollars from one year to another
adjusted = cpi.inflate(amount, start_year, end_year)
print(adjusted)
Verify before relying
- Whether the package fetches live CPI data or relies on bundled historical tables, and update frequency
- CLI interface capabilities and command syntax beyond the Python API
- Specific example values and year ranges supported by the inflate function
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — requests, click, python-dateutil, pandas |
| Maintenance | actively maintained — 213 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 139,204/month — #11,303 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cpi-2.0.10-py2.py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
forex-pythonFetches current and historical foreign exchange…
permissive · top 15,000 on PyPI
spm-calculatorCalculate Supplemental Poverty Measure (SPM)…
permissive · top 15,000 on PyPI
CurrencyConverterConverts currency amounts using historical…
unclear · top 15,000 on PyPI
pricesHandles monetary amounts with currency…
permissive · top 15,000 on PyPI
price-parserExtracts price amounts and currency symbols…
permissive · top 5,000 on PyPI
iso4217Provides ISO 4217 currency data as a Python…
permissive · top 15,000 on PyPI
currency-symbolsMaps ISO 4217 currency codes to their symbols…
permissive · top 5,000 on PyPI
py-moneyRepresents monetary amounts with currency-aware…
permissive · top 15,000 on PyPI
hdx-python-countryMaps country and region codes and names,…
permissive · top 15,000 on PyPI
django-moneyAdds Money and currency field types to Django…
permissive · top 5,000 on PyPI