This economic data analysis project makes use of Python for data analysis, and the FRED API for pulling out USA economic data about unemployment rates and participation rates per US state.
Note
I recommend going to the NBViewer URL provided in the About section of this repository for a richer view of the analysis in a Jupyter Notebook
- Request for FRED API Key
- Data Collection
- Environment Setup and Data Loading
- Data Cleaning
- Focused on May 2020 Economic Data
- Visualization of Unemployment Rates Per US State
- Visualization of Participation Rates Per US State
- Visualization of Unemployment Rate vs. Participation Rate Per US State
- Conclusion
- Next Steps
- References
To get your own FRED API key:
-
Register for an account in FRED
-
Go to
My Account > API Keys
-
Click the Request API Key button
-
Copy the API key generated for your account
After doing those steps, you then have to paste your API key inside a .py
file within a variable name of your choice.
You can then proceed to import the libraries required for analysis, and the API key from FRED
Using the FRED API key:
- Pulled in monthly unemployment rates per state in the USA
- Pulled in monthly labor participation rates per state in the USA
The economic data was loaded into Jupyter Lab using Python. Relevant libraries for data analysis were also imported:
pandas
: for Data Management and Data Manipulationnumpy
: for numerical and scientific computingmatplotlib
,seaborn
,plotly
: for data visualizationfredapi
: The API used to pull USA economic data.py file with API key
: stored the API key requested from FRED
The data cleaning methods included:
- Filtering economic data with monthly frequency
- Specifically querying seasonally adjusted economic data whose unit is in percent
- Concatenating economic data
- Dropping columns that are not about the unemployment and participation rates for every US state.
- Dropping missing values
- Fixed column names for better readability of the US states
- Pulled May 2020 unemployment rate data when it started skyrocketing
- Pulled May 2020 participation rate data when it started plummeting
- Used
plotly
to enable interactive line chart visualization of Unemployment rates per US State
- Generated a bar chart that sorted unemployment rates per US state from highest to lowest
- Used
plotly
to enable interactive line chart visualization of Participation rates per US State
- Generated a bar chart that sorted participation rates per US state from highest to lowest
- Plotted unemployment rate and participation rate in one big chart per US state.
blue
for unemployment ratered
for participation rate
Based on the final visualization, we can conclude a number of things:
-
It is safe to conclude that as unemployment rate skyrocketed during May 2020, participation rate plummeted.
- This is around the time when the COVID-19 Outbreak started booming, not just affecting healthcare, but every industry and household worldwide.
-
Over time, participation rate increased as unemployment rate decreased.
- Some US States (e.g., Tennessee Montana, Maine, Idaho, Delaware, South Dakota) seem to not follow the general trend
There might be some other economic factors affecting the labor and participation rates of these states during May 2020. Should the analysis of this economic data continues, this is something worth investigating.
- Rob Mulla. (2022, April 26). Economic Data Analysis Project with Python Pandas - Data scraping, cleaning and exploration! [Video]. YouTube. Retrieved November 22, 2023, from https://youtu.be/R67XuYc9NQ4?si=p0G707HjUCH6r1W-
- St. Louis Fed Web Services: FRED® API. (2009). Retrieved November 22, 2023, https://fred.stlouisfed.org/docs/api/fred/