Session Ready
Exercise

Unemployment

Unemployment varies by race and sex. In this exercise, you will start with a data frame, unemp_by_race, of percent unemployment by year for 25 to 54 year olds in four racial groups (White, Black, Asian, and Hispanic) and both sexes. You will create a bar plot of percent unemployment against year.

Because the column names will, after melting, become labels in your final plot, begin by providing column names that are shorter and clearer. The necessary code is provided at the beginning of the exercise.

pandas and seaborn have been imported with the usual aliases. unemp_by_race is loaded, and the dict you will use for renaming is displayed in the console.

Instructions
100 XP
  • melt the unemp_by_race data frame; set id_vars to "year", and remove the value_vars parameter to use all remaining columns as value columns
  • Create a bar plot of unemp_by_race, with the year on the x-axis and the percent unemployed on the y-axis, with hue determined the demographic group