Characteristics of Segregated Metros
So, you've determined that segregation is higher in Northern industrialized metro areas. But these are also large, diverse metro areas. Are low diversity cities just getting a pass? Let's compare how size and diversity correlate with metropolitan segregation.
The msa
DataFrame, as modified previously with the addition of the Index of Dissimilarity, has been loaded. The columns are listed in the console. Total population appears in the population
column.
pandas
and seaborn
have been loaded using the usual aliases.
This exercise is part of the course
Analyzing US Census Data in Python
Exercise instructions
- Plot segregation on the y-axis vs. metropolitan population on the x-axis
- Calculate the percentage African-American, and assign to column
black_pct
- Plot segregation vs. percentage African-American
- Create a scatterplot of segregation vs. percentage African-American. Add the
size
andhue
parameters, both set to the column"population"
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Are large metros more segregated?
sns.lmplot(x = ____, y = ____, data = msa)
plt.show()
# Calculate percentage African-American
msa["black_pct"] = ____
# Are more diverse metros more segregated?
sns.lmplot(____, ____, data = msa)
plt.show()
# Display metro size, percent Black, and segregation in one plot
sns.scatterplot(____, data = msa)
plt.show()