IniziaInizia gratis

Aggregate and Calculate Proportions

In this exercise we will explore Hispanic racial identity. Hispanics self-identify as a variety of races. We will use the sum() method to help calculate national percentages of Hispanics identifying as each race.

Census workers are often promulgating information to the public, who are used to seeing proportions as percentages. For this reason, we will use percentages in this exercise and throughout this course.

pandas has been imported as pd. State-level counts from table "P5 - Hispanic or Latino Origin by Race" have been loaded into the DataFrame states.

Questo esercizio fa parte del corso

Analyzing US Census Data in Python

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# What percentage of Hispanics identify as White?
print(100 * states[____].sum() / states[____].sum())
Modifica ed esegui il codice