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.
Este ejercicio forma parte del curso
Analyzing US Census Data in Python
Instrucciones del ejercicio
- 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
sizeandhueparameters, both set to the column"population"
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# 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()