Skip to content

Commit

Permalink
Update scripts for census data
Browse files Browse the repository at this point in the history
  • Loading branch information
jseabold committed Oct 27, 2012
1 parent 15a2168 commit f05c741
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 52 deletions.
104 changes: 52 additions & 52 deletions data/census_demographics.csv
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
state,per_black,per_hisp,per_white,educ_hs,educ_coll,average_income,median_income,pop_density,vote_pop,older_pop
ALABAMA,26.5,4.0,66.8,81.4,21.7,22984,42081,94.4,3001712.5,672383.6
ALASKA,3.6,5.8,63.7,90.7,27.0,30726,66521,1.2,475548.444,58540.158
ARIZONA,4.5,30.1,57.4,85.0,26.3,25680,50448,56.3,3934880.535,920515.71
ARKANSAS,15.6,6.6,74.2,81.9,19.1,21274,39267,56.0,1798043.148,428944.934
CALIFORNIA,6.6,38.1,39.7,80.7,30.1,29188,60883,239.1,24009747.944,4409953.704
COLORADO,4.3,20.9,69.7,89.3,35.9,30151,56456,48.5,3310567.012,578197.948
CONNECTICUT,11.1,13.8,70.9,88.4,35.2,36775,67740,738.1,2263008.088,515622.096
DELAWARE,21.9,8.4,65.1,87.0,27.7,29007,57599,460.8,568773.645,133348.845
DISTRICT OF COLUMBIA,50.7,9.5,35.3,86.5,49.2,42078,58526,9856.5,442485.136,70451.544
FLORIDA,16.5,22.9,57.5,85.3,25.9,26551,47661,350.6,11701330.788,3354127.392
GEORGIA,31.0,9.1,55.5,83.5,27.2,25134,49347,168.4,6242473.56,1079673.1
HAWAII,2.0,9.2,22.9,89.8,29.4,28882,66420,211.8,867505.11,202097.07
IDAHO,0.8,11.5,83.6,88.2,24.3,22518,46423,19.0,954160.97,202878.08
ILLINOIS,14.8,16.2,63.3,86.2,30.3,28782,55735,231.1,8133370.424,1634395.639
INDIANA,9.4,6.2,81.3,86.2,22.4,24058,47697,181.0,4060042.406,860233.704
IOWA,3.1,5.2,88.4,89.9,24.5,25335,48872,54.5,1880257.726,456284.041
KANSAS,6.1,10.8,77.8,89.2,29.3,25907,49424,34.9,1765811.37,381874.654
KENTUCKY,8.0,3.2,86.1,81.0,20.3,22515,41576,109.9,2757063.636,589863.06
LOUISIANA,32.4,4.4,60.1,81.0,20.9,23094,43445,104.9,2886721.516,571854.5
MAINE,1.3,1.4,94.3,89.8,26.5,25385,46933,43.1,842071.192,216494.644
MARYLAND,30.0,8.4,54.4,87.8,35.7,34849,70647,594.8,3753418.116,728536.125
MASSACHUSETTS,7.8,9.9,76.4,88.7,38.3,33966,64509,839.4,4262135.792,922255.04
MICHIGAN,14.3,4.5,76.4,88.0,25.0,25135,48432,174.8,6192369.249,1392542.367
MINNESOTA,5.4,4.9,82.8,91.3,31.4,29582,57243,66.6,3367262.43,700176.791
MISSISSIPPI,37.3,2.9,57.7,79.6,19.5,19977,37881,63.2,1840720.416,387206.56
MISSOURI,11.7,3.7,80.8,86.2,25.0,24724,46262,87.1,3744658.624,853517.696
MONTANA,0.5,3.1,87.5,91.0,27.9,23836,43872,6.8,623874.375,151726.248
NEBRASKA,4.7,9.5,81.8,90.0,27.7,25229,49342,23.8,1131381.574,250599.176
NEVADA,8.6,27.1,53.6,84.3,21.8,27589,55726,24.6,1718416.182,340415.25
NEW HAMPSHIRE,1.3,2.9,92.2,90.9,32.9,31422,63277,147.0,854189.712,184547.16
NEW JERSEY,14.6,18.1,58.9,87.3,34.6,34858,69811,1195.5,5566148.805,1208498.235
NEW MEXICO,2.5,46.7,40.2,82.7,25.5,22966,43820,17.0,1280567.76,283182.464
NEW YORK,17.5,18.0,58.0,84.4,32.1,30948,55603,411.2,12516121.671,2666731.989
NORTH CAROLINA,22.0,8.6,65.0,83.6,26.1,24745,45570,196.1,6093189.031,1274644.932
NORTH DAKOTA,1.3,2.2,88.6,89.4,26.3,25803,46781,9.7,434296.82,98486.208
OHIO,12.4,3.2,81.0,87.4,24.1,25113,47358,282.3,7204049.424,1650927.993
OKLAHOMA,7.7,9.2,68.2,85.4,22.6,23094,42979,54.7,2335568.928,519436.596
OREGON,2.0,12.0,78.1,88.6,28.6,26171,49260,39.9,2454758.606,553675.837
PENNSYLVANIA,11.3,5.9,79.2,87.4,26.4,27049,50398,283.9,7989789.522,1987890.216
RHODE ISLAND,7.2,12.8,76.5,83.7,30.3,28707,54902,1018.1,677038.488,154541.394
SOUTH CAROLINA,28.1,5.3,64.0,83.0,24.0,23443,43939,153.9,2938556.44,659771.43
SOUTH DAKOTA,1.4,2.9,84.4,89.3,25.3,24110,46369,10.7,501865.938,118667.808
TENNESSEE,16.9,4.7,75.4,82.5,22.7,23722,43314,153.9,4034112.39,877259.361
TEXAS,12.2,38.1,44.8,80.0,25.8,24870,49646,96.3,16021000.944,2695841.505
UTAH,1.3,13.2,80.1,90.6,29.4,23139,56330,33.6,1679064.312,259184.424
VERMONT,1.1,1.6,94.2,90.6,33.3,27478,51841,67.9,406553.719,93964.65
VIRGINIA,19.8,8.2,64.5,86.1,33.8,32145,61406,202.6,5230406.184,1012075.5
WASHINGTON,3.8,11.6,72.1,89.6,31.0,29733,57244,101.2,4378054.358,867414.826
WEST VIRGINIA,3.5,1.3,93.0,81.9,17.3,21232,38380,77.1,1170734.684,300568.968
WISCONSIN,6.5,6.1,83.1,89.4,25.8,26624,51598,105.0,3592701.443,793935.613
WYOMING,1.1,9.1,85.5,91.3,23.6,27860,53802,5.8,361348.488,72156.066
state,per_black,per_hisp,per_white,educ_hs,educ_coll,average_income,median_income,pop_density,vote_pop,older_pop,per_older,per_vote
ALABAMA,26.5,4.0,66.8,81.4,21.7,22984,42081,94.4,3001712.5,672383.6,0.14,0.625
ALASKA,3.6,5.8,63.7,90.7,27.0,30726,66521,1.2,475548.444,58540.158,0.081,0.658
ARIZONA,4.5,30.1,57.4,85.0,26.3,25680,50448,56.3,3934880.535,920515.71,0.142,0.607
ARKANSAS,15.6,6.6,74.2,81.9,19.1,21274,39267,56.0,1798043.148,428944.934,0.146,0.612
CALIFORNIA,6.6,38.1,39.7,80.7,30.1,29188,60883,239.1,24009747.944,4409953.704,0.117,0.637
COLORADO,4.3,20.9,69.7,89.3,35.9,30151,56456,48.5,3310567.012,578197.948,0.113,0.647
CONNECTICUT,11.1,13.8,70.9,88.4,35.2,36775,67740,738.1,2263008.088,515622.096,0.144,0.632
DELAWARE,21.9,8.4,65.1,87.0,27.7,29007,57599,460.8,568773.645,133348.845,0.147,0.627
DISTRICT OF COLUMBIA,50.7,9.5,35.3,86.5,49.2,42078,58526,9856.5,442485.136,70451.544,0.114,0.716
FLORIDA,16.5,22.9,57.5,85.3,25.9,26551,47661,350.6,11701330.788,3354127.392,0.176,0.614
GEORGIA,31.0,9.1,55.5,83.5,27.2,25134,49347,168.4,6242473.56,1079673.1,0.11,0.636
HAWAII,2.0,9.2,22.9,89.8,29.4,28882,66420,211.8,867505.11,202097.07,0.147,0.631
IDAHO,0.8,11.5,83.6,88.2,24.3,22518,46423,19.0,954160.97,202878.08,0.128,0.602
ILLINOIS,14.8,16.2,63.3,86.2,30.3,28782,55735,231.1,8133370.424,1634395.639,0.127,0.632
INDIANA,9.4,6.2,81.3,86.2,22.4,24058,47697,181.0,4060042.406,860233.704,0.132,0.623
IOWA,3.1,5.2,88.4,89.9,24.5,25335,48872,54.5,1880257.726,456284.041,0.149,0.614
KANSAS,6.1,10.8,77.8,89.2,29.3,25907,49424,34.9,1765811.37,381874.654,0.133,0.615
KENTUCKY,8.0,3.2,86.1,81.0,20.3,22515,41576,109.9,2757063.636,589863.06,0.135,0.631
LOUISIANA,32.4,4.4,60.1,81.0,20.9,23094,43445,104.9,2886721.516,571854.5,0.125,0.631
MAINE,1.3,1.4,94.3,89.8,26.5,25385,46933,43.1,842071.192,216494.644,0.163,0.634
MARYLAND,30.0,8.4,54.4,87.8,35.7,34849,70647,594.8,3753418.116,728536.125,0.125,0.644
MASSACHUSETTS,7.8,9.9,76.4,88.7,38.3,33966,64509,839.4,4262135.792,922255.04,0.14,0.647
MICHIGAN,14.3,4.5,76.4,88.0,25.0,25135,48432,174.8,6192369.249,1392542.367,0.141,0.627
MINNESOTA,5.4,4.9,82.8,91.3,31.4,29582,57243,66.6,3367262.43,700176.791,0.131,0.63
MISSISSIPPI,37.3,2.9,57.7,79.6,19.5,19977,37881,63.2,1840720.416,387206.56,0.13,0.618
MISSOURI,11.7,3.7,80.8,86.2,25.0,24724,46262,87.1,3744658.624,853517.696,0.142,0.623
MONTANA,0.5,3.1,87.5,91.0,27.9,23836,43872,6.8,623874.375,151726.248,0.152,0.625
NEBRASKA,4.7,9.5,81.8,90.0,27.7,25229,49342,23.8,1131381.574,250599.176,0.136,0.614
NEVADA,8.6,27.1,53.6,84.3,21.8,27589,55726,24.6,1718416.182,340415.25,0.125,0.631
NEW HAMPSHIRE,1.3,2.9,92.2,90.9,32.9,31422,63277,147.0,854189.712,184547.16,0.14,0.648
NEW JERSEY,14.6,18.1,58.9,87.3,34.6,34858,69811,1195.5,5566148.805,1208498.235,0.137,0.631
NEW MEXICO,2.5,46.7,40.2,82.7,25.5,22966,43820,17.0,1280567.76,283182.464,0.136,0.615
NEW YORK,17.5,18.0,58.0,84.4,32.1,30948,55603,411.2,12516121.671,2666731.989,0.137,0.643
NORTH CAROLINA,22.0,8.6,65.0,83.6,26.1,24745,45570,196.1,6093189.031,1274644.932,0.132,0.631
NORTH DAKOTA,1.3,2.2,88.6,89.4,26.3,25803,46781,9.7,434296.82,98486.208,0.144,0.635
OHIO,12.4,3.2,81.0,87.4,24.1,25113,47358,282.3,7204049.424,1650927.993,0.143,0.624
OKLAHOMA,7.7,9.2,68.2,85.4,22.6,23094,42979,54.7,2335568.928,519436.596,0.137,0.616
OREGON,2.0,12.0,78.1,88.6,28.6,26171,49260,39.9,2454758.606,553675.837,0.143,0.634
PENNSYLVANIA,11.3,5.9,79.2,87.4,26.4,27049,50398,283.9,7989789.522,1987890.216,0.156,0.627
RHODE ISLAND,7.2,12.8,76.5,83.7,30.3,28707,54902,1018.1,677038.488,154541.394,0.147,0.644
SOUTH CAROLINA,28.1,5.3,64.0,83.0,24.0,23443,43939,153.9,2938556.44,659771.43,0.141,0.628
SOUTH DAKOTA,1.4,2.9,84.4,89.3,25.3,24110,46369,10.7,501865.938,118667.808,0.144,0.609
TENNESSEE,16.9,4.7,75.4,82.5,22.7,23722,43314,153.9,4034112.39,877259.361,0.137,0.63
TEXAS,12.2,38.1,44.8,80.0,25.8,24870,49646,96.3,16021000.944,2695841.505,0.105,0.624
UTAH,1.3,13.2,80.1,90.6,29.4,23139,56330,33.6,1679064.312,259184.424,0.092,0.596
VERMONT,1.1,1.6,94.2,90.6,33.3,27478,51841,67.9,406553.719,93964.65,0.15,0.649
VIRGINIA,19.8,8.2,64.5,86.1,33.8,32145,61406,202.6,5230406.184,1012075.5,0.125,0.646
WASHINGTON,3.8,11.6,72.1,89.6,31.0,29733,57244,101.2,4378054.358,867414.826,0.127,0.641
WEST VIRGINIA,3.5,1.3,93.0,81.9,17.3,21232,38380,77.1,1170734.684,300568.968,0.162,0.631
WISCONSIN,6.5,6.1,83.1,89.4,25.8,26624,51598,105.0,3592701.443,793935.613,0.139,0.629
WYOMING,1.1,9.1,85.5,91.3,23.6,27860,53802,5.8,361348.488,72156.066,0.127,0.636
2 changes: 2 additions & 0 deletions get_census_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
del full_data_states["AGE775211"]
del full_data_states["SEX255211"] # % females - not enough variation
del full_data_states["RHI325211"]
full_data_states["per_older"] = older_pop / tot_pop
full_data_states["per_vote"] = vote_pop / tot_pop

full_data_states.rename(columns={
"INC110210" : "median_income",
Expand Down

0 comments on commit f05c741

Please sign in to comment.