Hacker News new | ask | show | jobs
by uzzgae 3074 days ago
Interesting that Ca and Tx data nearly mirrors this simple analysis of racial makeup vs racial statistics on homocide.

    per_capita_data = {'white': 3, 'asian': 1, 'black': 21, 'hispanic': 6}
    
    cali_cencus = {'white': 37.7, 'asian': 14.8, 'black': 6.5, 'hispanic': 37.7}
    texas_cencus = {'white': 42.4, 'asian': 4.8, 'black': 12.6, 'hispanic': 39.1}
    
    def calculate(per_capita, state_stats):
        rate = 0
        for race in per_capita:
            rate += per_capita[race] * (state_stats[race] / 100)
        return rate
    
    print calculate(per_capita_data, texas_cencus)
    print calculate(per_capita_data, cali_percentages)