skillfed

cpi

Quickly adjust U.S. dollars for inflation using the Consumer Price Index (CPI)

cpi v2.0.10 139.2K downloads/30d#11,303 on PyPI145
Permissive license MIT Active released

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 cpi

uv

uv add cpi

poetry

poetry add cpi

Installing 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.9

Tags

inflation adjustment CPIconvert dollars for inflationconsumer price index calculatorhistorical dollar valueadjust currency inflation USCPI inflation calculatorpurchasing power adjustment
inflationeconomicsdata-wrangling

More Utilities packages