{ "metadata": { "name": "", "signature": "sha256:7991051fcc76f8af884c00f556fbae9fa7de79cd1a5aabc42ca9ae7ae63206c8" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Final Exam - Option 1" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Census Data Analysis" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "**Data was downloaded the data from this link: http://thedataweb.rm.census.gov/ftp/cps_ftp.html**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Download the data disctionary for June 2015 and extract it in the same folder as this notebook." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "I will extract the data from this dictionary for the income, education, ethnicity and state. The U.S. Census Bureau documents this data as people have self-identified for each question on a Census survey." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then I'll display this information on a google map, displaying a visualization of the data on it's corresponding state from which it was recorded." ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Values to States\n", "states_map = { 1:'AL',30:'MT',2:'AK',31:'NE',4:'AZ',32:'NV',5:'AR',33:'NH',\n", " 6:'CA',34:'NJ',8:'CO',35:'NM',9:'CT',36:'NY',10:'DE',37:'NC',\n", " 11:'DC',38:'ND',12:'FL',39:'OH',13:'GA',40:'OK',15:'HI',41:'OR',\n", " 16:'ID',42:'PA',17:'IL',44:'RI',18:'IN',45:'SC',19:'IA',46:'SD',\n", " 20:'KS',47:'TN',21:'KY',48:'TX',22:'LA',49:'UT',23:'ME',50:'VT',\n", " 24:'MD',51:'VA',25:'MA',53:'WA',26:'MI',54:'WV',27:'MN',55:'WI',\n", " 28:'MS',56:'WY',29:'MO' }" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 50 }, { "cell_type": "code", "collapsed": false, "input": [ "#This value and higher will be considered RICH\n", "RICH_FLAG = 15 # $100,000 or more\n", "#This value and higher will be considered EDUCATED\n", "EDUCATED_FLAG = 43 # Bachelor's Degree or higher" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 51 }, { "cell_type": "code", "collapsed": false, "input": [ "#Values to Races\n", "#for simplicity I will group basic races\n", "WHITE = 1\n", "BLACK = 2\n", "NATIVE = 3 #American Indian, Alaskan Native\n", "ASIAN = 4\n", "ISLANDER = 5 #Hawaiian/Pacific Islander\n", "MULTI_RACIAL = 6 #Multi-Racial >= 6 " ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 52 }, { "cell_type": "code", "collapsed": false, "input": [ "#Create the lists we need to store the data we will retrieve\n", "#from the Census data dictionary\n", "income = []\n", "education = []\n", "ethnicity = [] \n", "state = []\n", "#to hold counts per state\n", "state_count = {} \n", "#to store values \n", "# RICH AND EDUCATED [W, B, AI, A, H, M\n", "# RICH AND NON-EDUCATED\n", "# NON-RICH AND EDUCATED \n", "# NON-RICH AND NON-EDUCATED \n", "# total]\n", "state_count_template = [0,0,0,0,0,0,\n", " 0,0,0,0,0,0,\n", " 0,0,0,0,0,0,\n", " 0,0,0,0,0,0,\n", " 0]" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 53 }, { "cell_type": "code", "collapsed": false, "input": [ "with open('jun15pub.dat') as data_file:\n", " for line in data_file.readlines():\n", "\n", " inc = int(line[38:40])\n", " edu = int(line[136:138])\n", " eth = int(line[138:140]) \n", " st = states_map[int(line[92:94])]\n", "\n", " income.append(inc)\n", " education.append(edu)\n", " ethnicity.append(eth) \n", " state.append(st)\n", "\n", " if st not in state_count:\n", " state_count[st] = state_count_template[:]\n", "\n", " #total count in states of all categories\n", " state_count[st][24] += 1\n", "\n", " #RICH AND EDUCATED\n", " if inc >= RICH_FLAG and edu >= EDUCATED_FLAG:\n", " if eth == WHITE: #White Only\n", " state_count[st][0] += 1\n", " elif eth == BLACK: #Black Only\n", " state_count[st][1] += 1\n", " elif eth == NATIVE: #American Indian, Alaskan Native Only\n", " state_count[st][2] += 1\n", " elif eth == ASIAN: #Asian Only\n", " state_count[st][3] += 1\n", " elif eth == ISLANDER: #Hawaiian/Pacific Islander Only\n", " state_count[st][4] += 1\n", " else: # Multi-Racial\n", " state_count[st][5] += 1\n", " #RICH AND NON-EDUCATED\n", " elif inc >= RICH_FLAG and edu < EDUCATED_FLAG: \n", " if eth == WHITE:\n", " state_count[st][6] += 1\n", " elif eth == BLACK:\n", " state_count[st][7] += 1\n", " elif eth == NATIVE:\n", " state_count[st][8] += 1\n", " elif eth == ASIAN:\n", " state_count[st][9] += 1\n", " elif eth == ISLANDER:\n", " state_count[st][10] += 1\n", " else: \n", " state_count[st][11] += 1\n", " #NON-RICH AND EDUCATED\n", " elif inc < RICH_FLAG and edu >= EDUCATED_FLAG:\n", " if eth == WHITE:\n", " state_count[st][12] += 1\n", " elif eth == BLACK:\n", " state_count[st][13] += 1\n", " elif eth == NATIVE:\n", " state_count[st][14] += 1\n", " elif eth == ASIAN:\n", " state_count[st][15] += 1\n", " elif eth == ISLANDER:\n", " state_count[st][16] += 1\n", " else: \n", " state_count[st][17] += 1\n", " #NON-RICH AND NON-EDUCATED\n", " else:\n", " if eth == WHITE:\n", " state_count[st][18] += 1\n", " elif eth == BLACK:\n", " state_count[st][19] += 1\n", " elif eth == NATIVE:\n", " state_count[st][20] += 1\n", " elif eth == ASIAN:\n", " state_count[st][21] += 1\n", " elif eth == ISLANDER:\n", " state_count[st][22] += 1\n", " else: \n", " state_count[st][23] += 1\n", " " ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 54 }, { "cell_type": "code", "collapsed": false, "input": [ "#Use these to store each group count to be displayed\n", "#with its corresponding state\n", "\n", "#RICH AND EDUCATED\n", "displayAW = \"\"\n", "displayAB = \"\"\n", "displayAI = \"\"\n", "displayAA = \"\"\n", "displayAH = \"\"\n", "displayAM = \"\"\n", "\n", "\n", "for state in state_count:\n", " #store the percentage of population group of each state\n", " groupAW = state_count[state][0]/float(state_count[state][24])\n", " groupAB = state_count[state][1]/float(state_count[state][24])\n", " groupAI = state_count[state][2]/float(state_count[state][24])\n", " groupAA = state_count[state][3]/float(state_count[state][24])\n", " groupAH = state_count[state][4]/float(state_count[state][24])\n", " groupAM = state_count[state][5]/float(state_count[state][24])\n", " \n", " #store these states with group value\n", " #these will be used as a tooltip on our map\n", " displayAW += \"['US-%s', %f],\" % (state,groupAW)\n", " displayAB += \"['US-%s', %f],\" % (state,groupAB)\n", " displayAI += \"['US-%s', %f],\" % (state,groupAI)\n", " displayAA += \"['US-%s', %f],\" % (state,groupAA)\n", " displayAH += \"['US-%s', %f],\" % (state,groupAH)\n", " displayAM += \"['US-%s', %f],\" % (state,groupAM)\n", "\n", "print 'RICH AND EDUCATED WHITE: ' \n", "print displayAW\n", "print 'RICH AND EDUCATED BLACK: ' \n", "print displayAB\n", "print 'RICH AND EDUCATED NATIVE: ' \n", "print displayAI\n", "print 'RICH AND EDUCATED ASIAN: ' \n", "print displayAA\n", "print 'RICH AND EDUCATED ISLANDER: ' \n", "print displayAH\n", "print 'RICH AND EDUCATED MULTI: ' \n", "print displayAM" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "RICH AND EDUCATED WHITE: \n", "['US-WA', 0.079305],['US-DE', 0.061598],['US-DC', 0.180545],['US-WI', 0.061496],['US-WV', 0.043390],['US-HI', 0.029602],['US-FL', 0.056660],['US-WY', 0.060202],['US-NH', 0.102284],['US-NJ', 0.117347],['US-NM', 0.042931],['US-TX', 0.067005],['US-LA', 0.046653],['US-NC', 0.052524],['US-ND', 0.060566],['US-NE', 0.058824],['US-TN', 0.053187],['US-NY', 0.089620],['US-PA', 0.083216],['US-CA', 0.079164],['US-NV', 0.049779],['US-VA', 0.115425],['US-CO', 0.104258],['US-AK', 0.064690],['US-AL', 0.036573],['US-AR', 0.047582],['US-VT', 0.087892],['US-IL', 0.102294],['US-GA', 0.041045],['US-IN', 0.065256],['US-IA', 0.069877],['US-OK', 0.039199],['US-AZ', 0.063705],['US-ID', 0.046457],['US-CT', 0.139755],['US-ME', 0.064861],['US-MD', 0.115734],['US-MA', 0.141243],['US-OH', 0.067410],['US-UT', 0.065114],['US-MO', 0.067971],['US-MN', 0.073522],['US-MI', 0.061341],['US-RI', 0.100126],['US-KS', 0.092233],['US-MT', 0.052387],['US-MS', 0.026998],['US-SC', 0.070473],['US-KY', 0.056444],['US-OR', 0.082814],['US-SD', 0.058824],\n", "RICH AND EDUCATED BLACK: \n", "['US-WA', 0.004532],['US-DE', 0.003330],['US-DC', 0.025292],['US-WI', 0.001377],['US-WV', 0.000289],['US-HI', 0.000463],['US-FL', 0.004735],['US-WY', 0.000000],['US-NH', 0.001427],['US-NJ', 0.009247],['US-NM', 0.002221],['US-TX', 0.004365],['US-LA', 0.006362],['US-NC', 0.008170],['US-ND', 0.000436],['US-NE', 0.001089],['US-TN', 0.004149],['US-NY', 0.006844],['US-PA', 0.003282],['US-CA', 0.004444],['US-NV', 0.002765],['US-VA', 0.009178],['US-CO', 0.000979],['US-AK', 0.002156],['US-AL', 0.004064],['US-AR', 0.003095],['US-VT', 0.000000],['US-IL', 0.005618],['US-GA', 0.012438],['US-IN', 0.001764],['US-IA', 0.001174],['US-OK', 0.002556],['US-AZ', 0.002096],['US-ID', 0.000000],['US-CT', 0.001114],['US-ME', 0.001889],['US-MD', 0.029173],['US-MA', 0.004590],['US-OH', 0.004213],['US-UT', 0.000431],['US-MO', 0.002445],['US-MN', 0.001922],['US-MI', 0.002992],['US-RI', 0.001889],['US-KS', 0.000000],['US-MT', 0.000332],['US-MS', 0.006750],['US-SC', 0.006244],['US-KY', 0.000000],['US-OR', 0.000445],['US-SD', 0.000000],\n", "RICH AND EDUCATED NATIVE: \n", "['US-WA', 0.000755],['US-DE', 0.000555],['US-DC', 0.001556],['US-WI', 0.000000],['US-WV', 0.000000],['US-HI', 0.000000],['US-FL', 0.000158],['US-WY', 0.000000],['US-NH', 0.000476],['US-NJ', 0.000319],['US-NM', 0.001480],['US-TX', 0.000472],['US-LA', 0.000000],['US-NC', 0.000584],['US-ND', 0.000871],['US-NE', 0.000000],['US-TN', 0.000000],['US-NY', 0.000000],['US-PA', 0.000000],['US-CA', 0.000165],['US-NV', 0.000553],['US-VA', 0.000000],['US-CO', 0.000000],['US-AK', 0.000000],['US-AL', 0.001016],['US-AR', 0.000387],['US-VT', 0.000000],['US-IL', 0.000234],['US-GA', 0.000000],['US-IN', 0.000000],['US-IA', 0.000000],['US-OK', 0.005113],['US-AZ', 0.000000],['US-ID', 0.000469],['US-CT', 0.000000],['US-ME', 0.000000],['US-MD', 0.000956],['US-MA', 0.000000],['US-OH', 0.000000],['US-UT', 0.000431],['US-MO', 0.000000],['US-MN', 0.000481],['US-MI', 0.000000],['US-RI', 0.000000],['US-KS', 0.000000],['US-MT', 0.000332],['US-MS', 0.000000],['US-SC', 0.000892],['US-KY', 0.000000],['US-OR', 0.000000],['US-SD', 0.001188],\n", "RICH AND EDUCATED ASIAN: \n", "['US-WA', 0.016239],['US-DE', 0.006659],['US-DC', 0.012451],['US-WI', 0.000918],['US-WV', 0.000868],['US-HI', 0.038390],['US-FL', 0.002841],['US-WY', 0.000919],['US-NH', 0.006660],['US-NJ', 0.027742],['US-NM', 0.002961],['US-TX', 0.007314],['US-LA', 0.003029],['US-NC', 0.002626],['US-ND', 0.001307],['US-NE', 0.000000],['US-TN', 0.001509],['US-NY', 0.010917],['US-PA', 0.006798],['US-CA', 0.023782],['US-NV', 0.003319],['US-VA', 0.016237],['US-CO', 0.006853],['US-AK', 0.002695],['US-AL', 0.000339],['US-AR', 0.002321],['US-VT', 0.000448],['US-IL', 0.013109],['US-GA', 0.003731],['US-IN', 0.000882],['US-IA', 0.005285],['US-OK', 0.004261],['US-AZ', 0.002515],['US-ID', 0.000000],['US-CT', 0.006682],['US-ME', 0.000630],['US-MD', 0.011478],['US-MA', 0.008828],['US-OH', 0.002230],['US-UT', 0.001725],['US-MO', 0.004890],['US-MN', 0.007689],['US-MI', 0.002095],['US-RI', 0.003778],['US-KS', 0.002157],['US-MT', 0.000663],['US-MS', 0.000710],['US-SC', 0.003122],['US-KY', 0.000000],['US-OR', 0.005343],['US-SD', 0.001188],\n", "RICH AND EDUCATED ISLANDER: \n", "['US-WA', 0.000000],['US-DE', 0.000000],['US-DC', 0.000389],['US-WI', 0.000000],['US-WV', 0.000000],['US-HI', 0.003700],['US-FL', 0.000000],['US-WY', 0.000460],['US-NH', 0.000000],['US-NJ', 0.000000],['US-NM', 0.000000],['US-TX', 0.000118],['US-LA', 0.000303],['US-NC', 0.000000],['US-ND', 0.000000],['US-NE', 0.000000],['US-TN', 0.000000],['US-NY', 0.000163],['US-PA', 0.000000],['US-CA', 0.000165],['US-NV', 0.001659],['US-VA', 0.000353],['US-CO', 0.000000],['US-AK', 0.001078],['US-AL', 0.000000],['US-AR', 0.000000],['US-VT', 0.000000],['US-IL', 0.000000],['US-GA', 0.000000],['US-IN', 0.000000],['US-IA', 0.000000],['US-OK', 0.000000],['US-AZ', 0.000000],['US-ID', 0.000000],['US-CT', 0.000000],['US-ME', 0.000000],['US-MD', 0.000000],['US-MA', 0.000000],['US-OH', 0.000000],['US-UT', 0.000000],['US-MO', 0.000000],['US-MN', 0.000000],['US-MI', 0.000000],['US-RI', 0.000000],['US-KS', 0.000000],['US-MT', 0.000000],['US-MS', 0.000000],['US-SC', 0.000000],['US-KY', 0.000000],['US-OR', 0.000000],['US-SD', 0.000000],\n", "RICH AND EDUCATED MULTI: \n", "['US-WA', 0.003776],['US-DE', 0.000000],['US-DC', 0.003891],['US-WI', 0.000459],['US-WV', 0.000579],['US-HI', 0.007401],['US-FL', 0.000789],['US-WY', 0.000460],['US-NH', 0.000951],['US-NJ', 0.000638],['US-NM', 0.000740],['US-TX', 0.000590],['US-LA', 0.000909],['US-NC', 0.000292],['US-ND', 0.000000],['US-NE', 0.000545],['US-TN', 0.000377],['US-NY', 0.000978],['US-PA', 0.001172],['US-CA', 0.002304],['US-NV', 0.000000],['US-VA', 0.001412],['US-CO', 0.000489],['US-AK', 0.004313],['US-AL', 0.000000],['US-AR', 0.000000],['US-VT', 0.000448],['US-IL', 0.001404],['US-GA', 0.000311],['US-IN', 0.000000],['US-IA', 0.000587],['US-OK', 0.002130],['US-AZ', 0.000419],['US-ID', 0.000469],['US-CT', 0.000557],['US-ME', 0.000630],['US-MD', 0.002391],['US-MA', 0.001059],['US-OH', 0.000496],['US-UT', 0.000431],['US-MO', 0.000978],['US-MN', 0.000481],['US-MI', 0.000299],['US-RI', 0.001259],['US-KS', 0.000539],['US-MT', 0.000663],['US-MS', 0.000000],['US-SC', 0.000892],['US-KY', 0.000000],['US-OR', 0.000000],['US-SD', 0.000000],\n" ] } ], "prompt_number": 55 }, { "cell_type": "code", "collapsed": false, "input": [ "#Use these to store each group count to be displayed\n", "#with its corresponding state\n", "\n", "#RICH AND NON-EDUCATED\n", "displayBW = \"\"\n", "displayBB = \"\"\n", "displayBI = \"\"\n", "displayBA = \"\"\n", "displayBH = \"\"\n", "displayBM = \"\"\n", "\n", "for state in state_count:\n", " #store the percentage of population group of each state\n", " groupBW = state_count[state][6]/float(state_count[state][24])\n", " groupBB = state_count[state][7]/float(state_count[state][24])\n", " groupBI = state_count[state][8]/float(state_count[state][24])\n", " groupBA = state_count[state][9]/float(state_count[state][24])\n", " groupBH = state_count[state][10]/float(state_count[state][24])\n", " groupBM = state_count[state][11]/float(state_count[state][24])\n", " \n", " #store these states with group value\n", " #these will be used as a tooltip on our map\n", " displayBW += \"['US-%s', %f],\" % (state,groupBW)\n", " displayBB += \"['US-%s', %f],\" % (state,groupBB)\n", " displayBI += \"['US-%s', %f],\" % (state,groupBI)\n", " displayBA += \"['US-%s', %f],\" % (state,groupBA)\n", " displayBH += \"['US-%s', %f],\" % (state,groupBH)\n", " displayBM += \"['US-%s', %f],\" % (state,groupBM)\n", "\n", "print 'RICH AND NON-EDUCATED WHITE: ' \n", "print displayBW\n", "print 'RICH AND NON-EDUCATED BLACK: ' \n", "print displayBB\n", "print 'RICH AND NON-EDUCATED NATIVE: ' \n", "print displayBI\n", "print 'RICH AND NON-EDUCATED ASIAN: ' \n", "print displayBA\n", "print 'RICH AND NON-EDUCATED ISLANDER: ' \n", "print displayBH\n", "print 'RICH AND NON-EDUCATED MULTI: ' \n", "print displayBM" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "RICH AND NON-EDUCATED WHITE: \n", "['US-WA', 0.120091],['US-DE', 0.084351],['US-DC', 0.047082],['US-WI', 0.094539],['US-WV', 0.076656],['US-HI', 0.028215],['US-FL', 0.068971],['US-WY', 0.153493],['US-NH', 0.146527],['US-NJ', 0.131696],['US-NM', 0.062176],['US-TX', 0.104164],['US-LA', 0.088155],['US-NC', 0.063612],['US-ND', 0.132898],['US-NE', 0.129085],['US-TN', 0.067522],['US-NY', 0.091250],['US-PA', 0.111111],['US-CA', 0.103028],['US-NV', 0.087389],['US-VA', 0.126015],['US-CO', 0.123837],['US-AK', 0.124528],['US-AL', 0.074162],['US-AR', 0.076983],['US-VT', 0.089238],['US-IL', 0.138109],['US-GA', 0.058147],['US-IN', 0.097443],['US-IA', 0.085731],['US-OK', 0.086919],['US-AZ', 0.092624],['US-ID', 0.105584],['US-CT', 0.174276],['US-ME', 0.084383],['US-MD', 0.115734],['US-MA', 0.131356],['US-OH', 0.086245],['US-UT', 0.153083],['US-MO', 0.084108],['US-MN', 0.150408],['US-MI', 0.084979],['US-RI', 0.113350],['US-KS', 0.092233],['US-MT', 0.093833],['US-MS', 0.053996],['US-SC', 0.073149],['US-KY', 0.074925],['US-OR', 0.114871],['US-SD', 0.101010],\n", "RICH AND NON-EDUCATED BLACK: \n", "['US-WA', 0.006420],['US-DE', 0.011099],['US-DC', 0.013230],['US-WI', 0.004130],['US-WV', 0.001446],['US-HI', 0.001388],['US-FL', 0.004735],['US-WY', 0.000919],['US-NH', 0.000476],['US-NJ', 0.016582],['US-NM', 0.001110],['US-TX', 0.009201],['US-LA', 0.018782],['US-NC', 0.009921],['US-ND', 0.000000],['US-NE', 0.000545],['US-TN', 0.003395],['US-NY', 0.013036],['US-PA', 0.008439],['US-CA', 0.004115],['US-NV', 0.009956],['US-VA', 0.019767],['US-CO', 0.002447],['US-AK', 0.001617],['US-AL', 0.016593],['US-AR', 0.008124],['US-VT', 0.000448],['US-IL', 0.008895],['US-GA', 0.017724],['US-IN', 0.003527],['US-IA', 0.002349],['US-OK', 0.003409],['US-AZ', 0.001676],['US-ID', 0.000469],['US-CT', 0.006125],['US-ME', 0.002519],['US-MD', 0.036346],['US-MA', 0.009181],['US-OH', 0.004957],['US-UT', 0.002587],['US-MO', 0.007824],['US-MN', 0.000961],['US-MI', 0.005685],['US-RI', 0.000630],['US-KS', 0.000539],['US-MT', 0.001658],['US-MS', 0.013144],['US-SC', 0.008921],['US-KY', 0.001998],['US-OR', 0.001781],['US-SD', 0.002377],\n", "RICH AND NON-EDUCATED NATIVE: \n", "['US-WA', 0.000378],['US-DE', 0.000000],['US-DC', 0.001946],['US-WI', 0.000000],['US-WV', 0.000000],['US-HI', 0.000000],['US-FL', 0.000473],['US-WY', 0.000000],['US-NH', 0.000000],['US-NJ', 0.000638],['US-NM', 0.002591],['US-TX', 0.000118],['US-LA', 0.000000],['US-NC', 0.000000],['US-ND', 0.003922],['US-NE', 0.001089],['US-TN', 0.000000],['US-NY', 0.000163],['US-PA', 0.000000],['US-CA', 0.000494],['US-NV', 0.001659],['US-VA', 0.000353],['US-CO', 0.000000],['US-AK', 0.012938],['US-AL', 0.001016],['US-AR', 0.001161],['US-VT', 0.000448],['US-IL', 0.000000],['US-GA', 0.000000],['US-IN', 0.000000],['US-IA', 0.000000],['US-OK', 0.007669],['US-AZ', 0.001257],['US-ID', 0.000000],['US-CT', 0.000000],['US-ME', 0.000000],['US-MD', 0.000478],['US-MA', 0.000000],['US-OH', 0.000000],['US-UT', 0.001294],['US-MO', 0.000000],['US-MN', 0.000000],['US-MI', 0.001496],['US-RI', 0.000000],['US-KS', 0.001079],['US-MT', 0.004310],['US-MS', 0.000355],['US-SC', 0.000000],['US-KY', 0.000000],['US-OR', 0.001781],['US-SD', 0.003565],\n", "RICH AND NON-EDUCATED ASIAN: \n", "['US-WA', 0.012840],['US-DE', 0.006104],['US-DC', 0.002724],['US-WI', 0.002295],['US-WV', 0.000000],['US-HI', 0.080019],['US-FL', 0.002525],['US-WY', 0.000460],['US-NH', 0.006660],['US-NJ', 0.016901],['US-NM', 0.004811],['US-TX', 0.006252],['US-LA', 0.001818],['US-NC', 0.003502],['US-ND', 0.001307],['US-NE', 0.000545],['US-TN', 0.001509],['US-NY', 0.006681],['US-PA', 0.004219],['US-CA', 0.025346],['US-NV', 0.003872],['US-VA', 0.012001],['US-CO', 0.005384],['US-AK', 0.005930],['US-AL', 0.002709],['US-AR', 0.001547],['US-VT', 0.000897],['US-IL', 0.013109],['US-GA', 0.001866],['US-IN', 0.000882],['US-IA', 0.002936],['US-OK', 0.003835],['US-AZ', 0.002096],['US-ID', 0.000469],['US-CT', 0.002227],['US-ME', 0.000000],['US-MD', 0.005261],['US-MA', 0.006356],['US-OH', 0.002726],['US-UT', 0.001294],['US-MO', 0.001956],['US-MN', 0.006728],['US-MI', 0.002095],['US-RI', 0.001889],['US-KS', 0.010248],['US-MT', 0.000000],['US-MS', 0.000710],['US-SC', 0.001338],['US-KY', 0.000999],['US-OR', 0.009350],['US-SD', 0.000594],\n", "RICH AND NON-EDUCATED ISLANDER: \n", "['US-WA', 0.001511],['US-DE', 0.000000],['US-DC', 0.000000],['US-WI', 0.000000],['US-WV', 0.000000],['US-HI', 0.012026],['US-FL', 0.000000],['US-WY', 0.000000],['US-NH', 0.000476],['US-NJ', 0.000000],['US-NM', 0.000000],['US-TX', 0.000000],['US-LA', 0.000000],['US-NC', 0.000000],['US-ND', 0.000000],['US-NE', 0.000545],['US-TN', 0.000000],['US-NY', 0.000000],['US-PA', 0.000000],['US-CA', 0.001317],['US-NV', 0.002212],['US-VA', 0.000000],['US-CO', 0.000000],['US-AK', 0.001617],['US-AL', 0.000000],['US-AR', 0.000000],['US-VT', 0.000000],['US-IL', 0.000234],['US-GA', 0.000000],['US-IN', 0.000000],['US-IA', 0.000000],['US-OK', 0.000000],['US-AZ', 0.000000],['US-ID', 0.000000],['US-CT', 0.000000],['US-ME', 0.000000],['US-MD', 0.000000],['US-MA', 0.000000],['US-OH', 0.000248],['US-UT', 0.000000],['US-MO', 0.000000],['US-MN', 0.000000],['US-MI', 0.000000],['US-RI', 0.000000],['US-KS', 0.000000],['US-MT', 0.000000],['US-MS', 0.000000],['US-SC', 0.000000],['US-KY', 0.000000],['US-OR', 0.000000],['US-SD', 0.000000],\n", "RICH AND NON-EDUCATED MULTI: \n", "['US-WA', 0.009441],['US-DE', 0.001110],['US-DC', 0.002335],['US-WI', 0.002754],['US-WV', 0.000579],['US-HI', 0.029140],['US-FL', 0.002052],['US-WY', 0.003217],['US-NH', 0.003330],['US-NJ', 0.001913],['US-NM', 0.002961],['US-TX', 0.002949],['US-LA', 0.002121],['US-NC', 0.002918],['US-ND', 0.001743],['US-NE', 0.002179],['US-TN', 0.003772],['US-NY', 0.006355],['US-PA', 0.001875],['US-CA', 0.006254],['US-NV', 0.003319],['US-VA', 0.004236],['US-CO', 0.006853],['US-AK', 0.014016],['US-AL', 0.000000],['US-AR', 0.000000],['US-VT', 0.000897],['US-IL', 0.002107],['US-GA', 0.001244],['US-IN', 0.000000],['US-IA', 0.001174],['US-OK', 0.002130],['US-AZ', 0.002515],['US-ID', 0.000939],['US-CT', 0.002227],['US-ME', 0.000630],['US-MD', 0.013869],['US-MA', 0.001412],['US-OH', 0.003470],['US-UT', 0.004312],['US-MO', 0.004401],['US-MN', 0.002403],['US-MI', 0.003890],['US-RI', 0.000000],['US-KS', 0.001618],['US-MT', 0.002653],['US-MS', 0.000355],['US-SC', 0.000446],['US-KY', 0.000500],['US-OR', 0.006233],['US-SD', 0.000000],\n" ] } ], "prompt_number": 56 }, { "cell_type": "code", "collapsed": false, "input": [ "#Use these to store each group count to be displayed\n", "#with its corresponding state\n", "\n", "#NON-RICH AND EDUCATED\n", "displayCW = \"\"\n", "displayCB = \"\"\n", "displayCI = \"\"\n", "displayCA = \"\"\n", "displayCH = \"\"\n", "displayCM = \"\"\n", "\n", "for state in state_count:\n", " #store the percentage of population group of each state\n", " groupCW = state_count[state][12]/float(state_count[state][24])\n", " groupCB = state_count[state][13]/float(state_count[state][24])\n", " groupCI = state_count[state][14]/float(state_count[state][24])\n", " groupCA = state_count[state][15]/float(state_count[state][24])\n", " groupCH = state_count[state][16]/float(state_count[state][24])\n", " groupCM = state_count[state][17]/float(state_count[state][24])\n", " \n", " #store these states with group value\n", " #these will be used as a tooltip on our map\n", " displayCW += \"['US-%s', %f],\" % (state,groupCW)\n", " displayCB += \"['US-%s', %f],\" % (state,groupCB)\n", " displayCI += \"['US-%s', %f],\" % (state,groupCI)\n", " displayCA += \"['US-%s', %f],\" % (state,groupCA)\n", " displayCH += \"['US-%s', %f],\" % (state,groupCH)\n", " displayCM += \"['US-%s', %f],\" % (state,groupCM)\n", "\n", "print 'NON-RICH AND EDUCATED WHITE: ' \n", "print displayCW\n", "print 'NON-RICH AND EDUCATED BLACK: ' \n", "print displayCB\n", "print 'NON-RICH AND EDUCATED NATIVE: ' \n", "print displayCI\n", "print 'NON-RICH AND EDUCATED ASIAN: ' \n", "print displayCA\n", "print 'NON-RICH AND EDUCATED ISLANDER: ' \n", "print displayCH\n", "print 'NON-RICH AND EDUCATED MULTI: ' \n", "print displayCM" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "NON-RICH AND EDUCATED WHITE: \n", "['US-WA', 0.103097],['US-DE', 0.102664],['US-DC', 0.091051],['US-WI', 0.117026],['US-WV', 0.081574],['US-HI', 0.043478],['US-FL', 0.099116],['US-WY', 0.095588],['US-NH', 0.109895],['US-NJ', 0.091199],['US-NM', 0.093264],['US-TX', 0.071252],['US-LA', 0.062708],['US-NC', 0.098629],['US-ND', 0.104139],['US-NE', 0.106209],['US-TN', 0.097322],['US-NY', 0.089946],['US-PA', 0.104079],['US-CA', 0.077930],['US-NV', 0.082965],['US-VA', 0.080833],['US-CO', 0.137053],['US-AK', 0.069542],['US-AL', 0.077887],['US-AR', 0.075822],['US-VT', 0.153812],['US-IL', 0.101826],['US-GA', 0.079913],['US-IN', 0.095679],['US-IA', 0.095713],['US-OK', 0.074137],['US-AZ', 0.092624],['US-ID', 0.122008],['US-CT', 0.099666],['US-ME', 0.105793],['US-MD', 0.055476],['US-MA', 0.100636],['US-OH', 0.097893],['US-UT', 0.105649],['US-MO', 0.112469],['US-MN', 0.112446],['US-MI', 0.090365],['US-RI', 0.120907],['US-KS', 0.101402],['US-MT', 0.137268],['US-MS', 0.064298],['US-SC', 0.079393],['US-KY', 0.084416],['US-OR', 0.123330],['US-SD', 0.115270],\n", "NON-RICH AND EDUCATED BLACK: \n", "['US-WA', 0.003021],['US-DE', 0.013873],['US-DC', 0.044747],['US-WI', 0.000918],['US-WV', 0.002314],['US-HI', 0.003238],['US-FL', 0.015625],['US-WY', 0.000460],['US-NH', 0.000476],['US-NJ', 0.013074],['US-NM', 0.003701],['US-TX', 0.011797],['US-LA', 0.020903],['US-NC', 0.021885],['US-ND', 0.002179],['US-NE', 0.004902],['US-TN', 0.012071],['US-NY', 0.012058],['US-PA', 0.011017],['US-CA', 0.006007],['US-NV', 0.008850],['US-VA', 0.017296],['US-CO', 0.008321],['US-AK', 0.003235],['US-AL', 0.018964],['US-AR', 0.011992],['US-VT', 0.000000],['US-IL', 0.011236],['US-GA', 0.034204],['US-IN', 0.009700],['US-IA', 0.002349],['US-OK', 0.004261],['US-AZ', 0.005029],['US-ID', 0.001408],['US-CT', 0.006682],['US-ME', 0.000000],['US-MD', 0.029651],['US-MA', 0.001766],['US-OH', 0.007187],['US-UT', 0.000431],['US-MO', 0.008802],['US-MN', 0.003844],['US-MI', 0.009874],['US-RI', 0.005038],['US-KS', 0.004315],['US-MT', 0.000332],['US-MS', 0.030551],['US-SC', 0.015611],['US-KY', 0.003996],['US-OR', 0.001336],['US-SD', 0.000000],\n", "NON-RICH AND EDUCATED NATIVE: \n", "['US-WA', 0.003399],['US-DE', 0.000000],['US-DC', 0.000389],['US-WI', 0.000000],['US-WV', 0.000000],['US-HI', 0.000925],['US-FL', 0.000631],['US-WY', 0.000460],['US-NH', 0.000476],['US-NJ', 0.000000],['US-NM', 0.004441],['US-TX', 0.000826],['US-LA', 0.000303],['US-NC', 0.001459],['US-ND', 0.003050],['US-NE', 0.000000],['US-TN', 0.000377],['US-NY', 0.000163],['US-PA', 0.000000],['US-CA', 0.000576],['US-NV', 0.002212],['US-VA', 0.000353],['US-CO', 0.000000],['US-AK', 0.004852],['US-AL', 0.000677],['US-AR', 0.000000],['US-VT', 0.000000],['US-IL', 0.000234],['US-GA', 0.000000],['US-IN', 0.000000],['US-IA', 0.000587],['US-OK', 0.003835],['US-AZ', 0.002934],['US-ID', 0.000939],['US-CT', 0.000000],['US-ME', 0.000000],['US-MD', 0.000956],['US-MA', 0.000000],['US-OH', 0.000000],['US-UT', 0.000862],['US-MO', 0.000489],['US-MN', 0.000000],['US-MI', 0.000598],['US-RI', 0.000000],['US-KS', 0.001618],['US-MT', 0.002653],['US-MS', 0.000000],['US-SC', 0.000000],['US-KY', 0.000000],['US-OR', 0.000445],['US-SD', 0.002377],\n", "NON-RICH AND EDUCATED ASIAN: \n", "['US-WA', 0.012085],['US-DE', 0.006104],['US-DC', 0.013230],['US-WI', 0.002754],['US-WV', 0.002025],['US-HI', 0.053654],['US-FL', 0.003630],['US-WY', 0.000460],['US-NH', 0.004282],['US-NJ', 0.015944],['US-NM', 0.001850],['US-TX', 0.009673],['US-LA', 0.004847],['US-NC', 0.004669],['US-ND', 0.005229],['US-NE', 0.003813],['US-TN', 0.003395],['US-NY', 0.017109],['US-PA', 0.003282],['US-CA', 0.024194],['US-NV', 0.014934],['US-VA', 0.010236],['US-CO', 0.003426],['US-AK', 0.009704],['US-AL', 0.004064],['US-AR', 0.001547],['US-VT', 0.003139],['US-IL', 0.015215],['US-GA', 0.009639],['US-IN', 0.002646],['US-IA', 0.004110],['US-OK', 0.002983],['US-AZ', 0.003353],['US-ID', 0.001877],['US-CT', 0.010579],['US-ME', 0.002519],['US-MD', 0.007652],['US-MA', 0.011653],['US-OH', 0.006444],['US-UT', 0.002587],['US-MO', 0.001467],['US-MN', 0.003844],['US-MI', 0.007780],['US-RI', 0.006297],['US-KS', 0.004854],['US-MT', 0.000663],['US-MS', 0.001421],['US-SC', 0.001784],['US-KY', 0.005495],['US-OR', 0.005788],['US-SD', 0.002971],\n", "NON-RICH AND EDUCATED ISLANDER: \n", "['US-WA', 0.000755],['US-DE', 0.000000],['US-DC', 0.000389],['US-WI', 0.000000],['US-WV', 0.000000],['US-HI', 0.009713],['US-FL', 0.000000],['US-WY', 0.000000],['US-NH', 0.000000],['US-NJ', 0.000319],['US-NM', 0.000000],['US-TX', 0.000354],['US-LA', 0.000303],['US-NC', 0.000292],['US-ND', 0.000000],['US-NE', 0.000000],['US-TN', 0.000000],['US-NY', 0.000815],['US-PA', 0.000000],['US-CA', 0.000576],['US-NV', 0.000553],['US-VA', 0.000000],['US-CO', 0.000979],['US-AK', 0.001617],['US-AL', 0.000000],['US-AR', 0.000000],['US-VT', 0.000000],['US-IL', 0.000468],['US-GA', 0.000622],['US-IN', 0.000000],['US-IA', 0.000587],['US-OK', 0.000000],['US-AZ', 0.000000],['US-ID', 0.000939],['US-CT', 0.000000],['US-ME', 0.000000],['US-MD', 0.000000],['US-MA', 0.000000],['US-OH', 0.000496],['US-UT', 0.000862],['US-MO', 0.000000],['US-MN', 0.000000],['US-MI', 0.000000],['US-RI', 0.000000],['US-KS', 0.000000],['US-MT', 0.000000],['US-MS', 0.000000],['US-SC', 0.000000],['US-KY', 0.000000],['US-OR', 0.000890],['US-SD', 0.000000],\n", "NON-RICH AND EDUCATED MULTI: \n", "['US-WA', 0.001888],['US-DE', 0.000555],['US-DC', 0.001556],['US-WI', 0.000918],['US-WV', 0.001446],['US-HI', 0.006938],['US-FL', 0.000631],['US-WY', 0.001838],['US-NH', 0.001427],['US-NJ', 0.001276],['US-NM', 0.001480],['US-TX', 0.001180],['US-LA', 0.000909],['US-NC', 0.001167],['US-ND', 0.000436],['US-NE', 0.001089],['US-TN', 0.001132],['US-NY', 0.000978],['US-PA', 0.002344],['US-CA', 0.001646],['US-NV', 0.001659],['US-VA', 0.002118],['US-CO', 0.000979],['US-AK', 0.000539],['US-AL', 0.001355],['US-AR', 0.000387],['US-VT', 0.002242],['US-IL', 0.000702],['US-GA', 0.001555],['US-IN', 0.001323],['US-IA', 0.001762],['US-OK', 0.002983],['US-AZ', 0.003772],['US-ID', 0.000000],['US-CT', 0.000000],['US-ME', 0.001889],['US-MD', 0.000956],['US-MA', 0.001412],['US-OH', 0.000743],['US-UT', 0.000431],['US-MO', 0.001956],['US-MN', 0.000481],['US-MI', 0.002394],['US-RI', 0.001259],['US-KS', 0.001618],['US-MT', 0.000332],['US-MS', 0.000000],['US-SC', 0.000000],['US-KY', 0.000500],['US-OR', 0.001336],['US-SD', 0.000594],\n" ] } ], "prompt_number": 57 }, { "cell_type": "code", "collapsed": false, "input": [ "#Use these to store each group count to be displayed\n", "#with its corresponding state\n", "\n", "#NON-RICH AND NON-EDUCATED\n", "displayDW = \"\"\n", "displayDB = \"\"\n", "displayDI = \"\"\n", "displayDA = \"\"\n", "displayDH = \"\"\n", "displayDM = \"\"\n", "\n", "for state in state_count:\n", " #store the percentage of population group of each state\n", " groupDW = state_count[state][18]/float(state_count[state][24])\n", " groupDB = state_count[state][19]/float(state_count[state][24])\n", " groupDI = state_count[state][20]/float(state_count[state][24])\n", " groupDA = state_count[state][21]/float(state_count[state][24])\n", " groupDH = state_count[state][22]/float(state_count[state][24])\n", " groupDM = state_count[state][23]/float(state_count[state][24])\n", " \n", " #store these states with group value\n", " #these will be used as a tooltip on our map\n", " displayDW += \"['US-%s', %f],\" % (state,groupDW)\n", " displayDB += \"['US-%s', %f],\" % (state,groupDB)\n", " displayDI += \"['US-%s', %f],\" % (state,groupDI)\n", " displayDA += \"['US-%s', %f],\" % (state,groupDA)\n", " displayDH += \"['US-%s', %f],\" % (state,groupDH)\n", " displayDM += \"['US-%s', %f],\" % (state,groupDM)\n", "\n", "print 'NON-RICH AND NON-EDUCATED WHITE: ' \n", "print displayDW\n", "print 'NON-RICH AND NON-EDUCATED BLACK: ' \n", "print displayDB\n", "print 'NON-RICH AND NON-EDUCATED NATIVE: ' \n", "print displayDI\n", "print 'NON-RICH AND NON-EDUCATED ASIAN: ' \n", "print displayDA\n", "print 'NON-RICH AND NON-EDUCATED ISLANDER: ' \n", "print displayDH\n", "print 'NON-RICH AND NON-EDUCATED MULTI: ' \n", "print displayDM" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "NON-RICH AND NON-EDUCATED WHITE: \n", "['US-WA', 0.408233],['US-DE', 0.381798],['US-DC', 0.047471],['US-WI', 0.546581],['US-WV', 0.593000],['US-HI', 0.117021],['US-FL', 0.454072],['US-WY', 0.503676],['US-NH', 0.415794],['US-NJ', 0.312181],['US-NM', 0.499630],['US-TX', 0.458535],['US-LA', 0.377158],['US-NC', 0.411730],['US-ND', 0.441394],['US-NE', 0.508170],['US-TN', 0.477178],['US-NY', 0.344794],['US-PA', 0.439991],['US-CA', 0.438199],['US-NV', 0.420907],['US-VA', 0.324391],['US-CO', 0.437102],['US-AK', 0.294879],['US-AL', 0.397900],['US-AR', 0.504062],['US-VT', 0.435874],['US-IL', 0.395599],['US-GA', 0.362873],['US-IN', 0.506614],['US-IA', 0.566060],['US-OK', 0.464849],['US-AZ', 0.479044],['US-ID', 0.587048],['US-CT', 0.341314],['US-ME', 0.484887],['US-MD', 0.241033],['US-MA', 0.338277],['US-OH', 0.487485],['US-UT', 0.526951],['US-MO', 0.449389],['US-MN', 0.444978],['US-MI', 0.461700],['US-RI', 0.411839],['US-KS', 0.462244],['US-MT', 0.517573],['US-MS', 0.366963],['US-SC', 0.376896],['US-KY', 0.575924],['US-OR', 0.489314],['US-SD', 0.507427],\n", "NON-RICH AND NON-EDUCATED BLACK: \n", "['US-WA', 0.016994],['US-DE', 0.133185],['US-DC', 0.243969],['US-WI', 0.033961],['US-WV', 0.019960],['US-HI', 0.021739],['US-FL', 0.096907],['US-WY', 0.005974],['US-NH', 0.007612],['US-NJ', 0.068878],['US-NM', 0.011103],['US-TX', 0.077032],['US-LA', 0.216601],['US-NC', 0.131894],['US-ND', 0.023094],['US-NE', 0.035403],['US-TN', 0.098831],['US-NY', 0.090435],['US-PA', 0.056493],['US-CA', 0.032916],['US-NV', 0.060841],['US-VA', 0.114366],['US-CO', 0.024474],['US-AK', 0.026954],['US-AL', 0.169319],['US-AR', 0.098646],['US-VT', 0.001345],['US-IL', 0.065309],['US-GA', 0.212376],['US-IN', 0.052469],['US-IA', 0.024075],['US-OK', 0.045590],['US-AZ', 0.036044],['US-ID', 0.004223],['US-CT', 0.057350],['US-ME', 0.001259],['US-MD', 0.147298],['US-MA', 0.043785],['US-OH', 0.082280],['US-UT', 0.004743],['US-MO', 0.073350],['US-MN', 0.040365],['US-MI', 0.092759],['US-RI', 0.037783],['US-KS', 0.037217],['US-MT', 0.006631],['US-MS', 0.264298],['US-SC', 0.187333],['US-KY', 0.039461],['US-OR', 0.009795],['US-SD', 0.013666],\n", "NON-RICH AND NON-EDUCATED NATIVE: \n", "['US-WA', 0.018505],['US-DE', 0.002220],['US-DC', 0.001556],['US-WI', 0.002754],['US-WV', 0.002025],['US-HI', 0.001850],['US-FL', 0.000473],['US-WY', 0.010110],['US-NH', 0.001427],['US-NJ', 0.000000],['US-NM', 0.108438],['US-TX', 0.004247],['US-LA', 0.003332],['US-NC', 0.015465],['US-ND', 0.035730],['US-NE', 0.017429],['US-TN', 0.000754],['US-NY', 0.005703],['US-PA', 0.003751],['US-CA', 0.004608],['US-NV', 0.038164],['US-VA', 0.001059],['US-CO', 0.004405],['US-AK', 0.097035],['US-AL', 0.000000],['US-AR', 0.001934],['US-VT', 0.000448],['US-IL', 0.001170],['US-GA', 0.002177],['US-IN', 0.000882],['US-IA', 0.004110],['US-OK', 0.057094],['US-AZ', 0.021375],['US-ID', 0.005631],['US-CT', 0.000557],['US-ME', 0.008186],['US-MD', 0.000478],['US-MA', 0.001766],['US-OH', 0.000496],['US-UT', 0.008193],['US-MO', 0.003912],['US-MN', 0.007689],['US-MI', 0.002992],['US-RI', 0.013854],['US-KS', 0.005394],['US-MT', 0.025199],['US-MS', 0.001066],['US-SC', 0.002230],['US-KY', 0.001998],['US-OR', 0.003562],['US-SD', 0.064765],\n", "NON-RICH AND NON-EDUCATED ASIAN: \n", "['US-WA', 0.030211],['US-DE', 0.002775],['US-DC', 0.003891],['US-WI', 0.014227],['US-WV', 0.000289],['US-HI', 0.196577],['US-FL', 0.010101],['US-WY', 0.000919],['US-NH', 0.006185],['US-NJ', 0.023916],['US-NM', 0.009623],['US-TX', 0.018403],['US-LA', 0.007573],['US-NC', 0.009338],['US-ND', 0.006100],['US-NE', 0.008715],['US-TN', 0.006790],['US-NY', 0.037478],['US-PA', 0.011252],['US-CA', 0.056205],['US-NV', 0.030420],['US-VA', 0.012001],['US-CO', 0.009790],['US-AK', 0.049596],['US-AL', 0.006773],['US-AR', 0.005029],['US-VT', 0.002691],['US-IL', 0.017088],['US-GA', 0.014614],['US-IN', 0.008377],['US-IA', 0.012918],['US-OK', 0.011078],['US-AZ', 0.011316],['US-ID', 0.003754],['US-CT', 0.010022],['US-ME', 0.010705],['US-MD', 0.021999],['US-MA', 0.019068],['US-OH', 0.005948],['US-UT', 0.010781],['US-MO', 0.002934],['US-MN', 0.018260],['US-MI', 0.006882],['US-RI', 0.014484],['US-KS', 0.019957],['US-MT', 0.002653],['US-MS', 0.001421],['US-SC', 0.002676],['US-KY', 0.008492],['US-OR', 0.015583],['US-SD', 0.007724],\n", "NON-RICH AND NON-EDUCATED ISLANDER: \n", "['US-WA', 0.003399],['US-DE', 0.000000],['US-DC', 0.000000],['US-WI', 0.000000],['US-WV', 0.000000],['US-HI', 0.110083],['US-FL', 0.000158],['US-WY', 0.000000],['US-NH', 0.000476],['US-NJ', 0.000000],['US-NM', 0.000000],['US-TX', 0.001180],['US-LA', 0.000000],['US-NC', 0.001167],['US-ND', 0.000436],['US-NE', 0.000000],['US-TN', 0.002263],['US-NY', 0.004888],['US-PA', 0.000469],['US-CA', 0.004855],['US-NV', 0.009403],['US-VA', 0.002471],['US-CO', 0.000489],['US-AK', 0.005391],['US-AL', 0.003048],['US-AR', 0.003868],['US-VT', 0.000448],['US-IL', 0.000936],['US-GA', 0.001555],['US-IN', 0.001764],['US-IA', 0.001174],['US-OK', 0.003409],['US-AZ', 0.006287],['US-ID', 0.002816],['US-CT', 0.000000],['US-ME', 0.000000],['US-MD', 0.000000],['US-MA', 0.000000],['US-OH', 0.000248],['US-UT', 0.009056],['US-MO', 0.000978],['US-MN', 0.000000],['US-MI', 0.000000],['US-RI', 0.000000],['US-KS', 0.000000],['US-MT', 0.000995],['US-MS', 0.000355],['US-SC', 0.001338],['US-KY', 0.000000],['US-OR', 0.004452],['US-SD', 0.000594],\n", "NON-RICH AND NON-EDUCATED MULTI: \n", "['US-WA', 0.143127],['US-DE', 0.182020],['US-DC', 0.260311],['US-WI', 0.112896],['US-WV', 0.173561],['US-HI', 0.204440],['US-FL', 0.174716],['US-WY', 0.160386],['US-NH', 0.182683],['US-NJ', 0.150191],['US-NM', 0.142487],['US-TX', 0.142975],['US-LA', 0.137231],['US-NC', 0.158156],['US-ND', 0.175163],['US-NE', 0.119826],['US-TN', 0.164466],['US-NY', 0.169627],['US-PA', 0.147211],['US-CA', 0.101712],['US-NV', 0.162611],['US-VA', 0.129898],['US-CO', 0.121880],['US-AK', 0.201078],['US-AL', 0.183542],['US-AR', 0.155513],['US-VT', 0.219283],['US-IL', 0.105103],['US-GA', 0.143968],['US-IN', 0.150794],['US-IA', 0.117440],['US-OK', 0.172561],['US-AZ', 0.169321],['US-ID', 0.114500],['US-CT', 0.140869],['US-ME', 0.229219],['US-MD', 0.163080],['US-MA', 0.177613],['US-OH', 0.138786],['US-UT', 0.098749],['US-MO', 0.169682],['US-MN', 0.123498],['US-MI', 0.159785],['US-RI', 0.165617],['US-KS', 0.160734],['US-MT', 0.148873],['US-MS', 0.166607],['US-SC', 0.167261],['US-KY', 0.144855],['US-OR', 0.121549],['US-SD', 0.115865],\n" ] } ], "prompt_number": 58 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Setup Rich and Educated Maps" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#create google map with the data we set\n", "def write_html(grp,rep):\n", " html = \"\"\n", " with open('map.html') as f:\n", " for line in f.readlines():\n", " if 'REPLACE_ME' in line:\n", " html += rep\n", " else:\n", " html += line\n", "\n", " with open(\"index-%s.html\" % (grp),\"w\") as f:\n", " f.write(html)\n", "\n", "write_html('aw',displayAW)\n", "write_html('ab',displayAB)\n", "write_html('ai',displayAI)\n", "write_html('aa',displayAA)\n", "write_html('ah',displayAH)\n", "write_html('am',displayAM)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 59 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Rich and Educated Maps" ] }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: White Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-aw.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 60, "text": [ "" ] } ], "prompt_number": 60 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Black Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-ab.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 61, "text": [ "" ] } ], "prompt_number": 61 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: American Indian, Alaskan Native Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-ai.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 62, "text": [ "" ] } ], "prompt_number": 62 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Asian Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-aa.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 63, "text": [ "" ] } ], "prompt_number": 63 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Hawaiian/Pacific Islander Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-ah.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 64, "text": [ "" ] } ], "prompt_number": 64 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Multi-Racial (Self Identifies as a combination of 2 or more races)" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-am.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 65, "text": [ "" ] } ], "prompt_number": 65 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Setup Rich and Uneducated Maps" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#create google map with the data we set\n", "def write_html(grp,rep):\n", " html = \"\"\n", " with open('map.html') as f:\n", " for line in f.readlines():\n", " if 'REPLACE_ME' in line:\n", " html += rep\n", " else:\n", " html += line\n", "\n", " with open(\"index-%s.html\" % (grp),\"w\") as f:\n", " f.write(html)\n", "\n", "write_html('bw',displayBW)\n", "write_html('bb',displayBB)\n", "write_html('bi',displayBI)\n", "write_html('ba',displayBA)\n", "write_html('bh',displayBH)\n", "write_html('bm',displayBM)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 66 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Rich and Uneducated Maps" ] }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: White Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-bw.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 67, "text": [ "" ] } ], "prompt_number": 67 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Black Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-bb.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 68, "text": [ "" ] } ], "prompt_number": 68 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: American Indian, Alaskan Native Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-bi.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 69, "text": [ "" ] } ], "prompt_number": 69 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Asian Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-ba.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 70, "text": [ "" ] } ], "prompt_number": 70 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Hawaiian/Pacific Islander Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-bh.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 71, "text": [ "" ] } ], "prompt_number": 71 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Multi-Racial (Self Identifies as a combination of 2 or more races)" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-bm.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 72, "text": [ "" ] } ], "prompt_number": 72 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Setup Non-Rich and Educated Maps" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#create google map with the data we set\n", "def write_html(grp,rep):\n", " html = \"\"\n", " with open('map.html') as f:\n", " for line in f.readlines():\n", " if 'REPLACE_ME' in line:\n", " html += rep\n", " else:\n", " html += line\n", "\n", " with open(\"index-%s.html\" % (grp),\"w\") as f:\n", " f.write(html)\n", "\n", "write_html('cw',displayCW)\n", "write_html('cb',displayCB)\n", "write_html('ci',displayCI)\n", "write_html('ca',displayCA)\n", "write_html('ch',displayCH)\n", "write_html('cm',displayCM)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 73 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Non-Rich and Educated Maps" ] }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: White Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-cw.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 74, "text": [ "" ] } ], "prompt_number": 74 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Black Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-cb.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 75, "text": [ "" ] } ], "prompt_number": 75 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: American Indian, Alaskan Native Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-ci.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 76, "text": [ "" ] } ], "prompt_number": 76 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Asian Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-ca.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 77, "text": [ "" ] } ], "prompt_number": 77 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Hawaiian/Pacific Islander Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-ch.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 78, "text": [ "" ] } ], "prompt_number": 78 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Multi-Racial (Self Identifies as a combination of 2 or more races)" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-cm.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 79, "text": [ "" ] } ], "prompt_number": 79 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Setup Non-Rich and Uneducated Maps" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#create google map with the data we set\n", "def write_html(grp,rep):\n", " html = \"\"\n", " with open('map.html') as f:\n", " for line in f.readlines():\n", " if 'REPLACE_ME' in line:\n", " html += rep\n", " else:\n", " html += line\n", "\n", " with open(\"index-%s.html\" % (grp),\"w\") as f:\n", " f.write(html)\n", "\n", "write_html('dw',displayDW)\n", "write_html('db',displayDB)\n", "write_html('di',displayDI)\n", "write_html('da',displayDA)\n", "write_html('dh',displayDH)\n", "write_html('dm',displayDM)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 80 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Non-Rich and Uneducated Maps" ] }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: White Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-dw.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 81, "text": [ "" ] } ], "prompt_number": 81 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Black Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-db.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 82, "text": [ "" ] } ], "prompt_number": 82 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: American Indian, Alaskan Native Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-di.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 83, "text": [ "" ] } ], "prompt_number": 83 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Asian Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-da.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 84, "text": [ "" ] } ], "prompt_number": 84 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Hawaiian/Pacific Islander Only" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-dh.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 85, "text": [ "" ] } ], "prompt_number": 85 }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "Race: Multi-Racial (Self Identifies as a combination of 2 or more races)" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.display import IFrame\n", "IFrame('index-dm.html', width=700, height=400)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 86, "text": [ "" ] } ], "prompt_number": 86 } ], "metadata": {} } ] }