Identify the Inflation Cause Using Python

Use Python to understand economic data and the cause of the current high inflation rate

Andrew Zhu (Shudong Zhu)
3 min readJun 23, 2022

The stock price is pluming; the crypto market is melting down; inflation is rocketing to its 40-years high; the whole economy is precarious. Everyone is talking about recession like every expert swore the inflation rate is under control just half a year ago.

Now the FED decided to control inflation. Here comes the question: What caused the inflation?

I am trying to use Python to find the answer from raw data.

Preparations for running Python code

There is no need to manually download data for analysis and plotting. Click here to get an API Key to access FRED data.

Then use the fredapi package to help fetch the series data.

pip install fredapi

For example, get SP500 data in three lines of code:

from fredapi import Fred
fred = Fred("fred api key")
sp500 = fred.get_series('SP500')

Is gas price the cause of inflation?

Read the news and watch TV, the economists and politicians claim that it is the war in European led to gas prices soaring and COVID lockdown blocked the supply chain. These two facts lead to the current high inflation rate.

--

--