Inflation Rate
Inflation Rate is the percentage change in the Consumer Price Index (CPI) from one period to another. It is a measure of the rate of price increases in the economy.
Data comes from the Global Macro Database (GMDB), further information about the variable can be found within https://www.globalmacrodata.com/documentation.html
The rate is expressed as a decimal fraction (0.0412 for 4.1166%) on an annual basis. The GMDB extends its series with IMF World Economic Outlook projections, so the current year and any later years the end_date reaches are forecasts rather than outturns.
Changed in v2.2.0: this used to be returned in percentage points (4.1166 for 4.1166%). It is now a decimal fraction, matching every other rate in the Finance Toolkit.
Also known as: CPI-based inflation, price increases, consumer prices.
Inflation Rate in Python
get_inflation_rate is part of the Economics module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_inflation_rate as shown below.
from financetoolkit import Economics
economics = Economics(start_date='2003-01-01', end_date='2009-03-01')
economics.get_inflation_rate(countries=['Germany', 'France', 'Portugal'])
Which returns:
| Germany | France | Portugal | |
|---|---|---|---|
| 2003 | 0.0103 | 0.021 | 0.0322 |
| 2004 | 0.0167 | 0.0214 | 0.0237 |
| 2005 | 0.0155 | 0.0175 | 0.0228 |
| 2006 | 0.0158 | 0.0168 | 0.0311 |
| 2007 | 0.023 | 0.0149 | 0.0245 |
| 2008 | 0.0263 | 0.0281 | 0.0259 |
| 2009 | 0.0031 | 0.0009 | -0.0084 |
Parameters
get_inflation_rate accepts the following parameters:
- countries (list[str] | str | None, optional): The countries to include in the data. Defaults to None.
- rolling (int, optional): The rolling window size to use for smoothing the data (simple moving average). Defaults to None.
- trailing (int, optional): The trailing window size to use for summing the data over trailing periods (e.g. a trailing-4-quarter sum). Defaults to None.
- growth (bool, optional): Whether to return the growth data or the actual data.
- lag (int, optional): The number of periods to lag the data by.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.