Get startedGet started for free

Employment and the Labor Force

1. Employment and the Labor Force

In this video we will look at unemployment and labor force participation over the past few years. We will define these concepts, then demonstrate how to download the data from multiple ACS years. Then we will create bar plots by year and demographic group.

2. Employment Concepts

We often hear about the unemployment rate. What does this mean? First, we need to define the Labor Force. This is people who are working or looking for work. Homemakers, full-time students, and retirees are not in the labor force. The unemployed are people unable to find work. People working part-time, even if they want to work full-time, are not considered unemployed. Neither are those whose work is not commensurate to their experience or training. The unemployment rate is the number of people unable to find work, divided by the labor force. Workers who get discouraged and stop looking for work are no longer in the labor force, so they are not considered unemployed! For this reason, some researchers think we should focus more on the labor force participation rate as a measure of the strength of the economy.

3. Creating a Bar Plot

Let's create a basic bar plot of unemployment over time. We start with a DataFrame showing percent unemployment by year. We call sns.barplot, with "year" on the x-axis, and "pct_unemployed" on the y-axis. Seaborn defaults to coloring each bar differently, so we will set a specific color "cornflowerblue", for all bars. This is the result. Unemployment has been declining consistently since 2011.

4. pandas.melt

We can also create a grouped bar plot, where the year is broken down by another category. This requires a tidy DataFrame, which we have seen previously. We begin with a DataFrame of hispanic_unemployment. Unemployment is shown by year for Male and Female Hispanics 25 to 54.

5. pandas.melt

The column names of the value columns will appear in our dataset and our graph, so let's replace them with shorter names. Now call melt on the DataFrame. The id_var is year. Set value_vars to the new column names "male" and "female". Then create the names "sex" and "pct_unemployed" for the output variable and value columns.

6. pandas.melt

We just commented out the line value_vars = ["male", "female"]. We can omit the value_vars parameter if all remaining numeric columns in the DataFrame will be used as value columns. In this dataset, we want both "male" and "female" to be used, so we can delete this parameter. This can be useful in a dataset with a large number of value columns.

7. pandas.melt

This is the resulting DataFrame. There are twice as many rows, one for each combination of year and sex.

8. Creating a Grouped Bar Chart

sns.barplot is called as before, with x set to "year" and y set to "pct_unemployed". But we now add the hue parameter, and set it equal to the column "sex". The values in this column, "male" and "female", now determine the colors of the bars, which are grouped by the x-parameter, "year".

9. Let's practice!

In the exercises, you will explore unemployment and labor force participation by race and sex. Let's go!