LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Analyzing US Census Data in Python

Kurs anzeigen

Anleitung zur Übung

  • 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

Interaktive Übung

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

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

# Create a barplot
sns.barplot(____, color = "cornflowerblue")
plt.show()
Code bearbeiten und ausführen