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




J of Jungle + 3 Plats Arduino/RPi/Pic = J3

Recommended from Medium

Klarna to report customer debts to credit agencies

SEC’s new SPAC policies are ‘not going to fix the problem:’ Expert

Running MySQL Databases on AWS EC2 — A Tutorial for Beginners

Energy Consumption Predictor

Churn Prediction in Telecom Industry

Tragedy of the Commons

Exploratory Data Analysis Snippets

Opportunities in Data Governance and Domain-specific Data preparation tools:

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


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

More from Medium

Send Emails Using Python

List Compherensions 1 Python

What is While Loop In Python?

Learning Python in 2022 — the no doubt way