The world economy has been through a lot in the last 15 years. From the financial crisis (aka "Great Recession"), through the pandemic and tension between China and the West, to the return of inflation and higher interest rates, the global economy has been under significant strain.
When the economy is going through turmoil, so are the people who make up the economy. Those economic problems can translate into trouble for governments. We've already seen a diverse set of countries, from the Netherlands to Argentina, vote out incumbents, in no small part because of people's economic frustration.
Of course, the United States will hold a presidential election next year, and President Joe Biden's supporters are already nervous. They aren't totally wrong to worry: The US might well have pulled off a "soft landing," reducing inflation without hurting growth or unemployment too much, but people are still noticing the rise in prices over the last few years, and aren't too happy about it.
Kyla Scanlon (https://kyla.substack.com) has been writing about this for a while, contrasting the actual (good) economic data with people's (bad) feelings, in what she calls a "vibecession."
What does the data say about the US economy, both by itself and in contrast with other developed economies? That's what we'll be looking at this week, giving us a picture that's better and deeper than the low "vibes" Scanlon writes about.
Data and 7 questions
This week, I thought that it would be interesting to look at the US economic data, both by itself and then in contrast with other economies. The data comes from the Organization for Economic Cooperation and Development (OECD), what the Economist likes to call "a club of mostly-rich countries."
We'll be looking at three different data files:
- GDP data for OECD countries, described at https://data.oecd.org/gdp/gross-domestic-product-gdp.htm . The CSV file we'll use is at https://stats.oecd.org/sdmx-json/data/DP_LIVE/.GDP.../OECD?contentType=csv&detail=code&separator=comma&csv-lang=en .
- Unemployment data for OECD countries, described at https://data.oecd.org/unemp/unemployment-rate.htm . The CSV file we'll use is at https://stats.oecd.org/sdmx-json/data/DP_LIVE/.HUR.../OECD?contentType=csv&detail=code&separator=comma&csv-lang=en .
- The consumer price index (CPI) for OECD countries, described at https://data.oecd.org/price/inflation-cpi.htm . The CSV file we'll use is at https://stats.oecd.org/sdmx-json/data/DP_LIVE/.CPI.../OECD?contentType=csv&detail=code&separator=comma&csv-lang=en .
This week, I have seven questions for you. The learning goals include plotting in Seaborn, applying functions with "pipe", pivot tables, and joins. I'll be back tomorrow with solutions, including the Jupyter notebook I used to develop my solutions.
- Create a data frame from each of the three CSV files.
- Use Seaborn to plot total US unemployment over the years. The x axis should contain the final two digits of each year. The y axis should be the percentage of unemployment reported.
- Recreate this same plot, but with lines for not just the US, but also for the UK, France, and Germany. (Use different-colored lines for each country.)
- From the CPI data frame, create one in which the index contains years, the columns are from the US, UK, France, and Germany, and the values represent the percentage change in total annual CPI from the previous year.
- Take the data frame from the previous task, and use Seaborn to create a line plot showing inflation in each of the countries. Show only from 1995 onward.
- Recreate the data frame from the previous task – except this time, get the quarterly CPI value, starting in 1995. Use Seaborn to create a line plot from that data. Given that the quarterly data includes 2023, what trends do we see in the countries we're examining?
- Get the per-capita GDP and unemployment rate for every country in 2022, and use Seaborn to create a scatter plot comparing them.
I'll be back tomorrow with my solutions. See you then!
Reuven