How to Calculate Consumer Price Index (CPI) In Python

Bradstreet, Sauerbeck, Laspeyres and Paasche CPI — #EconoSeries — Episode 00

J3
Jungletronics

--

How to run SIX Jupyter notebooks with Python code to automatically
CALCULATE from Excel table these INDEXES:
00_BRADSTREET
01_SAUERBECK_ARITHMETIC
02_SAUERBECK_GEOMETRIC
03_SAUERBECK_HARMONIC
04_LASPEYRES
05_PAASCHE
File: 00_commodities_basket.xlsx
You can replace the default table to whatever basket you’d like and the code must run nicely 🤨 Try it yourself!(Image from this page)

What is the Consumer Price Index?

Consumer Price Index (CPI) measures the average price of a basket of commodities commonly used by people relative to a base year. The base year CPI is marked as 100. The CPI for the year in which the measure is calculated is either below or more than 100. Thus, denoting whether the average price has increased or decreased over the period.

You can Download all theses notebooks from my git.

How to run:Download all files to your desktop
Run Google Colab
Load Excel file to the same dir
Load each .ipynb file
And Enjoy!

Calculating Consumer Price Index (CPI) involves measuring changes in price levels of a sample of representative goods and services used by the households in an economy over a specific period.

This market basket of commodities is developed based on the information provided by the households regarding their expenditures on different product and service categories.

Calculation of CPI takes two types; CPI for single item and for multiple item. How to calculate the Consumer Price Index (CPI) for single and for multiple item is explained here in detail.

Run yourself each notebook to learn more about Python and CPA.

That’s all, folks!

Enjoy!

Credits & References

Thank you, Mr. Ricardo A. Deckmann Zanardini — You are an Awesome Teacher! o/; Text edited while I’m studying Computer Engineer at Escola Superior Politécnica Uninter🏋!

--

--

J3
Jungletronics

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Ruby, Rails, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!