population of California in 2010: https://github.com/rdhyee/diversity-census-calc/blob/0.0.1/census_2010_sf1/state_five_categories.csv#L6
In [ ]:
pops = [14956253, 2163804, 4775070, 14013719, 1345110]
CA_pop = 37253956
In [ ]:
sum(pops) == CA_pop
https://en.wikipedia.org/wiki/Diversity_index#Shannon_index
$H' = -\sum_{i=1}^R p_i \ln p_i$
In [ ]:
# FILL IN
Compare with the entropy_5
column for California -- answer should be 0.7969941601550823
https://en.wikipedia.org/wiki/Diversity_index#Gini.E2.80.93Simpson_index
$1 - \lambda = 1 - \sum_{i=1}^R p_i^2 = 1 - 1/{}^2D$
In [ ]:
# FILL IN
Answer is 0.6762156265155197
In [ ]: