A Python library for inflation adjustment calculations using Consumer Price Index (CPI) data.
Project description
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
-
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.
-
Data Handling and Validation:
- Validates CPI data to ensure it meets the required criteria.
- Converts and processes CPI data for easy manipulation and calculation.
-
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
- Current Year Change 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
Built Distribution
File details
Details for the file dollarwave-2.0.5.tar.gz
.
File metadata
- Download URL: dollarwave-2.0.5.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 291f02c53c8cb78f0278205bc638bd57d1535a84fbdeef9b103d014ebaf51fdb |
|
MD5 | ae1fd23b150ba30bdf84737a4e95f138 |
|
BLAKE2b-256 | 1e84da3c4cd5bc86d0d6cd51ddf55bdb891c08238d9ffa8969087dfecc4668f4 |
File details
Details for the file dollarwave-2.0.5-py3-none-any.whl
.
File metadata
- Download URL: dollarwave-2.0.5-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | c563efb05bad2f2495080bf4696696a8830aa13e8a6ecc0b442668ff1f08510d |
|
MD5 | 6b79c392acca2ba828f26c4c377837dd |
|
BLAKE2b-256 | c06bd4a55b1b037e6f7d0dd75184046523d2045dc7cbbcb9a3b2ef516d1f9844 |