Published in


How to Calculate Consumer Price Index (CPI) In Python

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

How to run SIX Jupyter notebooks with Python code to automatically
CALCULATE from Excel table these INDEXES:
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!


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🏋!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store