Phillips curve using merge_ordered()
There is an economic theory developed by A. W. Phillips which states that inflation and unemployment have an inverse relationship. The theory claims that with economic growth comes inflation, which in turn should lead to more jobs and less unemployment.
You will take two tables of data from the U.S. Bureau of Labor Statistics, containing unemployment and inflation data over different periods, and create a Phillips curve. The tables have different frequencies. One table has a data entry every six months, while the other has a data entry every month. You will need to use the entries where you have data within both tables.
The tables unemployment
and inflation
have been loaded for you.
This exercise is part of the course
Joining Data with pandas
Exercise instructions
- Use
merge_ordered()
to merge theinflation
andunemployment
tables ondate
with an inner join, and save the results asinflation_unemploy
. - Print the
inflation_unemploy
dataframe. - Using
inflation_unemploy
, create a scatter plot withunemployment_rate
on the horizontal axis andcpi
(inflation) on the vertical axis.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Use merge_ordered() to merge inflation, unemployment with inner join
inflation_unemploy = ____
# Print inflation_unemploy
____
# Plot a scatter plot of unemployment_rate vs cpi of inflation_unemploy
inflation_unemploy.plot(____)
plt.show()