BW #20: World inflation
For the first time in decades, people are talking about inflation. This week, we compare different inflation measures across time and various countries.
A few years ago, I decided that it was time to teach my children about money, banking, economics, and so forth. Along with everything else, I told them about how prices tend to rise a bit each year, thanks to something known as "inflation," but that no one had really talked about inflation in a serious way in some time, and it was unlikely to be a major topic in the near future.
So... those comments didn’t age well. Inflation is now at its highest levels in decades. It’s a weird feeling, and while inflation levels are lower now than they were a year ago, they’re still higher than they were several years ago.
The thing is, how do we measure inflation? It's not enough to say, "We'll measure the increase in prices," because that assumes that there's a way to get a hold on all prices, everywhere. It also assumes that prices rise in lockstep, when that's rarely the case. And it also assumes that all prices are equally important, when that's not really the case. Of course, it's not *not* really the case either, right?
The US has two major inflation indexes, the Consumer Price Index (CPI) and the Producer Price Index (PPI). The first measures how much consumers are paying for things, and the second measures how much businesses are paying. The two are obviously linked, but they're also distinct. The Federal Reserve is known to prefer the PCE deflator (Personal Consumption Expenditure) when deciding whether to adjust interest rates. [Note: a previous version of this post said PPI; thanks to the reader who corrected me!]
But wait, there's also "core inflation," which tries to measure inflation without taking into account food and energy, which can be more volatile than other measures. Of course, you could argue that these are two of the most important things that people typically buy — so while core inflation might be less volatile, it's also less accurate.
And of course, some countries have experienced hyperinflation, where money loses value so fast that people buy things as quickly as they can, to avoid having anything in the bank lest it be worthless the next day. The story of how Brazil fixed their problem with hyperinflation, from an old Planet Money episode, is definitely worth listening to: https://www.npr.org/sections/money/2010/10/01/130267274/the-friday-podcast-how-four-drinking-buddies-saved-brazil.
Most developed economies aren't in any danger of hyperinflation. But inflation levels are definitely higher than they used to be, thanks to a whole bunch of different factors. The modern way to reduce inflation is by haivng the central bank raise interest rates, thus making money more expensive, meaning that it's harder to borrow money. When the economy slows down, the central bank can then reduce interest rates, allowing things to speed up again. It's hugely complex, and I don't envy the people who are trying to calculate inflation, let alone the central-bank employees who need to then decide on their interest-rate policies as a result.
The US just released new CPI and PPI data, and the Federal Reserve is deciding whether they should keep interest rates where they are, raise them a bit (to try to cool inflation further), or skip a decision for one meeting, as has been hinted at over the last week or two. Their decision will have a huge effect on not just the US economy, but on other countries' economies as well, both because the US trades with so many other places, and because other central banks often follow the Fed's lead.
Data
The World Bank, which lends money to countries that want to improve their economies and infrastructure, has been tracking inflation in a large number of countries for an awfully long time. They recently released their latest report on inflation rates, as described here:
https://www.worldbank.org/en/research/brief/inflation-database
You can download their history of inflation from this link on that page:
/content/files/en/doc/1ad246272dbbc437c74323719506aa0c-0350012021/original/inflation-data.xlsx
This will download an Excel file containing a number of different inflation measures for a wide variety of countries. Each inflation measure is on a different sheet, with the years as columns and the countries as rows.
This week, we'll ask some questions about inflation, and plot the trends that we see. I hope that you'll decide to explore this data further, perhaps comparing inflation in your country vs. others, and exploring the different inflationary measures and how they differ from one another.
From the Pandas perspective, this week's questions have to do with multi-indexes and using method chaining vs. assignment. Matt Harrison is a particularly vocal proponent of using method chaining, and I must say, he's starting to win me over, especially when we have some multi-level transformations to do. We'll perform our queries in a few different ways, to get experience working with them.
Questions
- From the Excel file, read the following three tabs: hcpi_a, ccpi_a, and ppi_a.
- Remove any rows in which either "Country" or "Series Name" is NaN.