Skip to main content

A Python library for inflation adjustment calculations using Consumer Price Index (CPI) data.

Project description

dollarwave Logo

Dollarwave Library: Inflation Adjustment Using CPI Data

The dollarwave module is a comprehensive library designed for adjusting the value of money across different years using Consumer Price Index (CPI) data. It offers extensive capabilities to handle and process CPI data, ensuring accurate inflation adjustments.

Table of Contents

Why dollarwave?

  • Accurate Inflation Adjustments: Utilizes CPI data to calculate the equivalent value of money across different years.
  • Easy to Use: Provides a straightforward API for calculating inflation-adjusted values.
  • Data Validation: Ensures the accuracy and consistency of CPI data used in calculations.

Key Features

  1. Inflation Adjustment Calculation:

    • Calculates the equivalent value of an amount of money in different years using CPI data.
    • Automatically switches to yearly averages if monthly data is not available for the most recent comparison year.
  2. Data Handling and Validation:

    • Validates CPI data to ensure it meets the required criteria.
    • Converts and processes CPI data for easy manipulation and calculation.
  3. Graphical User Interface (GUI):

    • User-friendly interface for performing inflation calculations without writing code.

Usage Examples

Calculating Inflation-Adjusted Values

Use the inflation_calculator to calculate the equivalent value of money across different years:

from dollarwave import inflation_calculator

# Calculate the adjusted value
original_amount = 1
original_year = 1970
target_year = 2024
adjusted_amount = inflation_calculator(original_amount, original_year, target_year)

Output:

$1 from 1970 is equivalent to $8.04 in 2024 dollars.
8.044961340206186

Using the GUI

You can also use the graphical user interface (GUI) to perform inflation calculations:

from dollarwave import GUI

# Run the GUI
GUI.run()

From the GUI, you can:

  • Calculate the inflation-adjusted value of an amount from the original year to the target year using CPI data.
  • Calculate the historical value change of a given dollar amount over the past n years compared to the current month's CPI.
  • Calculate the value of a given amount against the CPI values for each month of the current year where data is available.

GUI Screenshots

Here are some screenshots of the GUI in action:

  • Adjusted Value Tab

Adjusted Value Tab

  • Current Year Change Tab

Current Year Change Tab

  • Comparison Tab

Comparison Tab

Alternatively, you can use the inflation_calculator instance directly:

from dollarwave import inflation_calculator

# Calculate the current year change
print(inflation_calculator.current_year_change(amount=5))

Output:

{'January': 4.94, 'February': 4.97, 'March': 5.0, 'April': 5.02, 'May': 5.03, 'June': 5.03}
# Calculate historical comparison
print(inflation_calculator.comparison(amount=10, n_years=3, plot=False))

Output:

$10 from 2021 is equivalent to $8.68 in 2024 dollars.
$10 from 2022 is equivalent to $9.38 in 2024 dollars.
$10 from 2023 is equivalent to $9.76 in 2024 dollars.
{2021: 8.68, 2022: 9.38, 2023: 9.76}
# Calculate adjusted value
adjusted_amount = inflation_calculator.adjusted_value(amount=13, original_year=1991, target_year=2021)
print(f"${13} from {1991} is equivalent to ${adjusted_amount:.2f} in {2021} dollars.")

Output:

$13 from 1991 is equivalent to $25.86 in 2021 dollars.
25.86

Installation

To install the dollarwave library, use pip:

pip install dollarwave

Contributing

Contributions are welcome! Please read the contribution guidelines first.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dollarwave-2.0.4.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

dollarwave-2.0.4-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file dollarwave-2.0.4.tar.gz.

File metadata

  • Download URL: dollarwave-2.0.4.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.5

File hashes

Hashes for dollarwave-2.0.4.tar.gz
Algorithm Hash digest
SHA256 27cf6c529725bd3ac8ff72496c0e0e022359968253631d76a800efa2b09bfce8
MD5 6f15b524a1da63a10d01b855c404014f
BLAKE2b-256 49fd736c0f29a38c7ffc9576db92525b955f5b524c4f02d0b2e36e5840a20e15

See more details on using hashes here.

File details

Details for the file dollarwave-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: dollarwave-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.5

File hashes

Hashes for dollarwave-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8b8cd96925da17a4b5e72e367ca41aaeac836702c79d3d0b46ed85152b98ca59
MD5 7fa42142b727e3fd63cb958dae7b4c6c
BLAKE2b-256 d6f154678f9b27aed70cfe5479ce246fc51f211991f6af8f1beb7f05c81d2996

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page