ComeçarComece de graça

Immigration

While immigrants from foreign countries may stay for many years, we may be interested in new immigration, and how immigration is changing over time. In this exercise, you will use data from ACS Table B07410, which allows you to look specifically at movers who arrive from abroad and are not citizens –i.e. new immigrants.

The DataFrame us_immigration is loaded, and is displayed in the console. It shows new_immigrants and the total population by year, 2011-2017.

pandas and seaborn are imported using the usual aliases.

Este exercício faz parte do curso

Analyzing US Census Data in Python

Ver curso

Instruções do exercício

  • Calculate the percent of the population that are new immigrants, using the columns new_immigrant and total
  • Create a barplot of the percent of population that are new immigrants by year

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Calculate new immigrants as percent of current population
us_immigration["pct_new_immigrant"] = ____

# Create a barplot
sns.barplot(____, color = "cornflowerblue")
plt.show()
Editar e executar o código