Get startedGet started for free

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.

This exercise is part of the course

Analyzing US Census Data in Python

View Course

Exercise instructions

  • 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

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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

# Create a barplot
sns.barplot(____, color = "cornflowerblue")
plt.show()
Edit and Run Code