Labor Force Participation
Unemployment could be going down because labor force participation is decreasing, that is, fewer people are looking for work! In this exercise, you will investigate that possiblity. You will start with a DataFrame, lf_by_race, of percent labor force participation 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 labor force participation against year. In order to condition the bar plot by demographic group, you will first melt the DataFrame. The DataFrame already has suitable column names.
pandas and seaborn have been imported with the usual aliases. unemp_by_race is loaded and five columns are displayed in the console.
Questo esercizio fa parte del corso
Analyzing US Census Data in Python
Istruzioni dell'esercizio
meltthelf_by_raceDataFrame, settingvar_nameto"demographic"andvalue_nameto"labor_force_participation"; can you determine the appropriate column for theid_varsparameter?- Call
sns.barplotwith the year on the x-axis and labor force participation on the y-axis; then use thehueparameter to show sex grouped by year.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Melt DataFrame by demographic group
lf_by_race = lf_by_race.melt(
____,
____,
____
)
# Plot labor force particpation by group by year
sns.barplot(____)
plt.show()