LoslegenKostenlos loslegen

Impacts of Black-White Segregation by Sex

seaborn lets us plot two variables conditioned on a third variable. The two variables will be dissimilarity and unemployment, and we will condition the scatterplot on a third variable, sex, by changing the color of the points and regression line based on the sex being reported. But first we have to turn msa_black_emp into a "tidy" DataFrame.

msa_black_emp has been loaded, with columns "pct_male_unemp" and "pct_female_unemp" as calculated in the last exercise.

pandas and seaborn have been loaded using the usual aliases.

Diese Übung ist Teil des Kurses

Analyzing US Census Data in Python

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Restrict DataFrame to columns of interest, rename columns
tidy_black_emp = msa_black_emp[____]
tidy_black_emp.columns = ____
Code bearbeiten und ausführen