diff --git a/est14_OR.txt b/est14_OR.txt new file mode 100644 index 0000000..b5eff9a --- /dev/null +++ b/est14_OR.txt @@ -0,0 +1,37 @@ +41 0 637156 621361 652951 16.4 16.0 16.8 179110 171930 186290 21.3 20.4 22.2 117394 111176 123612 19.3 18.3 20.3 51088 50607 51569 56119 52798 59440 25.0 23.5 26.5 Oregon OR est14_OR.txt 06NOV2015 +41 1 3232 2646 3818 20.6 16.9 24.3 897 706 1088 29.2 23.0 35.4 623 489 757 28.3 22.2 34.4 38966 35475 42457 Baker County OR est14_OR.txt 06NOV2015 +41 3 15545 14152 16938 18.9 17.2 20.6 1864 1391 2337 13.0 9.7 16.3 1349 1001 1697 12.6 9.3 15.9 54089 49559 58619 Benton County OR est14_OR.txt 06NOV2015 +41 5 37450 32707 42193 9.5 8.3 10.7 10896 8848 12944 12.6 10.2 15.0 7530 6063 8997 11.5 9.3 13.7 65555 62792 68318 Clackamas County OR est14_OR.txt 06NOV2015 +41 7 5672 4567 6777 15.4 12.4 18.4 1621 1243 1999 22.7 17.4 28.0 1059 798 1320 20.6 15.5 25.7 45132 41123 49141 Clatsop County OR est14_OR.txt 06NOV2015 +41 9 5880 4714 7046 12.0 9.6 14.4 1817 1396 2238 16.8 12.9 20.7 1222 925 1519 14.8 11.2 18.4 57517 52697 62337 Columbia County OR est14_OR.txt 06NOV2015 +41 11 12144 10076 14212 19.8 16.4 23.2 3354 2614 4094 30.1 23.5 36.7 2322 1783 2861 28.9 22.2 35.6 39956 37328 42584 Coos County OR est14_OR.txt 06NOV2015 +41 13 3809 3115 4503 18.3 15.0 21.6 1079 832 1326 27.2 21.0 33.4 721 549 893 23.6 18.0 29.2 38155 34688 41622 Crook County OR est14_OR.txt 06NOV2015 +41 15 3780 3027 4533 17.1 13.7 20.5 858 643 1073 25.3 19.0 31.6 600 445 755 24.7 18.3 31.1 40524 37448 43600 Curry County OR est14_OR.txt 06NOV2015 +41 17 22298 19233 25363 13.2 11.4 15.0 6345 4973 7717 17.8 14.0 21.6 4479 3445 5513 16.8 12.9 20.7 52387 49264 55510 Deschutes County OR est14_OR.txt 06NOV2015 +41 19 21001 18102 23900 19.9 17.2 22.6 5769 4674 6864 28.5 23.1 33.9 3793 2976 4610 25.7 20.2 31.2 41504 39033 43975 Douglas County OR est14_OR.txt 06NOV2015 +41 21 223 170 276 11.7 8.9 14.5 75 56 94 20.1 15.1 25.1 52 39 65 20.8 15.4 26.2 51978 46849 57107 Gilliam County OR est14_OR.txt 06NOV2015 +41 23 1190 925 1455 16.8 13.1 20.5 355 268 442 27.1 20.4 33.8 241 179 303 24.8 18.4 31.2 41304 37034 45574 Grant County OR est14_OR.txt 06NOV2015 +41 25 1489 1216 1762 21.3 17.4 25.2 434 347 521 31.6 25.3 37.9 270 205 335 26.9 20.4 33.4 36340 32642 40038 Harney County OR est14_OR.txt 06NOV2015 +41 27 3298 2675 3921 14.6 11.8 17.4 1108 859 1357 20.1 15.6 24.6 727 551 903 18.1 13.7 22.5 54063 49516 58610 Hood River County OR est14_OR.txt 06NOV2015 +41 29 37566 33104 42028 18.1 16.0 20.2 11174 9332 13016 25.9 21.6 30.2 6951 5552 8350 22.3 17.8 26.8 44835 42373 47297 Jackson County OR est14_OR.txt 06NOV2015 +41 31 4513 3614 5412 21.2 17.0 25.4 1695 1319 2071 32.2 25.1 39.3 1138 872 1404 30.2 23.1 37.3 42753 39284 46222 Jefferson County OR est14_OR.txt 06NOV2015 +41 33 16921 14086 19756 20.6 17.2 24.0 5188 4185 6191 33.3 26.9 39.7 3453 2723 4183 30.2 23.8 36.6 37230 34074 40386 Josephine County OR est14_OR.txt 06NOV2015 +41 35 14092 12297 15887 21.9 19.1 24.7 4004 3246 4762 29.1 23.6 34.6 2613 2034 3192 26.6 20.7 32.5 39234 36331 42137 Klamath County OR est14_OR.txt 06NOV2015 +41 37 1429 1105 1753 19.3 14.9 23.7 406 308 504 28.3 21.5 35.1 273 202 344 24.9 18.5 31.3 40328 36280 44376 Lake County OR est14_OR.txt 06NOV2015 +41 39 64722 59856 69588 18.4 17.0 19.8 13379 10867 15891 20.1 16.3 23.9 8316 6528 10104 17.0 13.4 20.6 44976 42967 46985 Lane County OR est14_OR.txt 06NOV2015 +41 41 8628 7219 10037 18.8 15.7 21.9 2320 1840 2800 30.3 24.0 36.6 1601 1262 1940 30.0 23.6 36.4 40226 37101 43351 Lincoln County OR est14_OR.txt 06NOV2015 +41 43 22559 19999 25119 19.1 16.9 21.3 7215 6104 8326 26.8 22.7 30.9 4876 4083 5669 24.9 20.8 29.0 44358 41159 47557 Linn County OR est14_OR.txt 06NOV2015 +41 45 7756 6587 8925 28.7 24.4 33.0 2891 2409 3373 38.3 31.9 44.7 2016 1666 2366 37.4 30.9 43.9 35094 31618 38570 Malheur County OR est14_OR.txt 06NOV2015 +41 47 56064 49829 62299 17.7 15.7 19.7 20377 17489 23265 25.1 21.5 28.7 13302 11118 15486 22.6 18.9 26.3 48554 46347 50761 Marion County OR est14_OR.txt 06NOV2015 +41 49 1824 1452 2196 16.3 13.0 19.6 694 532 856 22.3 17.1 27.5 465 349 581 20.2 15.2 25.2 51839 46569 57109 Morrow County OR est14_OR.txt 06NOV2015 +41 51 141562 132955 150169 18.6 17.5 19.7 34845 30895 38795 23.2 20.6 25.8 21859 19012 24706 21.0 18.3 23.7 53519 51700 55338 Multnomah County OR est14_OR.txt 06NOV2015 +41 53 10721 8883 12559 14.1 11.7 16.5 3052 2309 3795 17.2 13.0 21.4 2047 1526 2568 15.5 11.6 19.4 52626 49042 56210 Polk County OR est14_OR.txt 06NOV2015 +41 55 241 184 298 14.2 10.8 17.6 70 53 87 23.4 17.6 29.2 48 35 61 20.3 15.0 25.6 53277 47661 58893 Sherman County OR est14_OR.txt 06NOV2015 +41 57 4347 3567 5127 17.5 14.4 20.6 1213 946 1480 25.9 20.2 31.6 764 571 957 23.0 17.2 28.8 41662 38375 44949 Tillamook County OR est14_OR.txt 06NOV2015 +41 59 13041 10920 15162 18.0 15.1 20.9 4894 3987 5801 25.2 20.5 29.9 3228 2583 3873 23.2 18.6 27.8 44780 41922 47638 Umatilla County OR est14_OR.txt 06NOV2015 +41 61 4418 3706 5130 17.7 14.8 20.6 1219 956 1482 22.0 17.3 26.7 841 660 1022 21.1 16.6 25.6 44841 41885 47797 Union County OR est14_OR.txt 06NOV2015 +41 63 1063 830 1296 15.8 12.3 19.3 319 245 393 26.1 20.0 32.2 215 164 266 24.6 18.7 30.5 39743 35852 43634 Wallowa County OR est14_OR.txt 06NOV2015 +41 65 4192 3403 4981 16.8 13.6 20.0 1299 970 1628 23.4 17.5 29.3 912 675 1149 22.8 16.9 28.7 44010 39913 48107 Wasco County OR est14_OR.txt 06NOV2015 +41 67 69403 63990 74816 12.5 11.5 13.5 21559 19144 23974 16.0 14.2 17.8 14247 12477 16017 14.5 12.7 16.3 66315 63653 68977 Washington County OR est14_OR.txt 06NOV2015 +41 69 315 249 381 23.3 18.4 28.2 83 63 103 39.5 30.1 48.9 57 43 71 37.7 28.4 47.0 33387 29800 36974 Wheeler County OR est14_OR.txt 06NOV2015 +41 71 14772 12562 16982 15.4 13.1 17.7 4744 3919 5569 20.5 16.9 24.1 3184 2576 3792 18.4 14.9 21.9 52903 49406 56400 Yamhill County OR est14_OR.txt 06NOV2015 diff --git a/est14_WA.txt b/est14_WA.txt new file mode 100644 index 0000000..77bb19a --- /dev/null +++ b/est14_WA.txt @@ -0,0 +1,40 @@ +53 0 913463 895355 931571 13.2 12.9 13.5 275662 265882 285442 17.5 16.9 18.1 180464 171990 188938 16.0 15.2 16.8 61358 60882 61834 85453 80800 90106 19.6 18.5 20.7 Washington WA est14_WA.txt 06NOV2015 +53 1 3598 2947 4249 19.0 15.6 22.4 1816 1477 2155 27.1 22.0 32.2 1152 903 1401 24.7 19.4 30.0 47423 42474 52372 Adams County WA est14_WA.txt 06NOV2015 +53 3 3573 2849 4297 16.3 13.0 19.6 1104 846 1362 24.2 18.5 29.9 723 546 900 21.5 16.2 26.8 44055 39944 48166 Asotin County WA est14_WA.txt 06NOV2015 +53 5 26893 23628 30158 14.6 12.8 16.4 10421 8839 12003 21.3 18.1 24.5 6754 5615 7893 19.0 15.8 22.2 58750 56072 61428 Benton County WA est14_WA.txt 06NOV2015 +53 7 10298 8470 12126 14.0 11.5 16.5 3588 2774 4402 20.2 15.6 24.8 2436 1839 3033 19.2 14.5 23.9 49174 45028 53320 Chelan County WA est14_WA.txt 06NOV2015 +53 9 11518 9848 13188 16.2 13.8 18.6 3267 2671 3863 26.2 21.4 31.0 2025 1593 2457 22.3 17.5 27.1 47185 43543 50827 Clallam County WA est14_WA.txt 06NOV2015 +53 11 44213 38703 49723 9.9 8.7 11.1 15179 12259 18099 13.6 11.0 16.2 10647 8436 12858 12.8 10.2 15.4 61747 60396 63098 Clark County WA est14_WA.txt 06NOV2015 +53 13 607 469 745 15.5 12.0 19.0 190 145 235 25.7 19.6 31.8 130 98 162 22.0 16.6 27.4 45465 41255 49675 Columbia County WA est14_WA.txt 06NOV2015 +53 15 20701 18425 22977 20.6 18.3 22.9 6118 5100 7136 26.8 22.3 31.3 3909 3166 4652 23.1 18.7 27.5 44235 41355 47115 Cowlitz County WA est14_WA.txt 06NOV2015 +53 17 6120 4978 7262 15.5 12.6 18.4 2507 1974 3040 24.4 19.2 29.6 1712 1339 2085 22.7 17.8 27.6 51151 47257 55045 Douglas County WA est14_WA.txt 06NOV2015 +53 19 1700 1392 2008 22.4 18.3 26.5 403 316 490 29.1 22.8 35.4 264 205 323 25.9 20.1 31.7 39992 36038 43946 Ferry County WA est14_WA.txt 06NOV2015 +53 21 14661 12404 16918 17.3 14.6 20.0 7214 6027 8401 24.9 20.8 29.0 4533 3611 5455 22.4 17.8 27.0 55006 51191 58821 Franklin County WA est14_WA.txt 06NOV2015 +53 23 310 240 380 14.2 11.0 17.4 91 70 112 20.7 15.8 25.6 60 45 75 17.4 13.1 21.7 46404 41508 51300 Garfield County WA est14_WA.txt 06NOV2015 +53 25 14508 11796 17220 15.8 12.8 18.8 5766 4441 7091 20.9 16.1 25.7 3918 2983 4853 20.0 15.2 24.8 50388 47611 53165 Grant County WA est14_WA.txt 06NOV2015 +53 27 13322 11257 15387 19.6 16.6 22.6 4146 3376 4916 28.6 23.3 33.9 2760 2199 3321 26.3 21.0 31.6 43205 40965 45445 Grays Harbor County WA est14_WA.txt 06NOV2015 +53 29 7964 6639 9289 10.3 8.6 12.0 2267 1801 2733 15.4 12.2 18.6 1514 1190 1838 14.7 11.6 17.8 59358 55827 62889 Island County WA est14_WA.txt 06NOV2015 +53 31 4183 3445 4921 14.1 11.6 16.6 972 770 1174 24.5 19.4 29.6 643 502 784 21.8 17.0 26.6 50964 46641 55287 Jefferson County WA est14_WA.txt 06NOV2015 +53 33 230750 218081 243419 11.3 10.7 11.9 58351 52757 63945 13.6 12.3 14.9 38527 34470 42584 12.8 11.5 14.1 75738 74417 77059 King County WA est14_WA.txt 06NOV2015 +53 35 27550 23819 31281 11.2 9.7 12.7 7473 6103 8843 14.4 11.8 17.0 4593 3607 5579 12.2 9.6 14.8 61898 59584 64212 Kitsap County WA est14_WA.txt 06NOV2015 +53 37 7459 6329 8589 18.6 15.8 21.4 1410 1105 1715 18.7 14.7 22.7 953 742 1164 17.6 13.7 21.5 48127 44926 51328 Kittitas County WA est14_WA.txt 06NOV2015 +53 39 3029 2365 3693 14.6 11.4 17.8 935 713 1157 22.6 17.2 28.0 641 481 801 20.9 15.7 26.1 49348 44723 53973 Klickitat County WA est14_WA.txt 06NOV2015 +53 41 12695 10463 14927 17.1 14.1 20.1 3912 3075 4749 24.5 19.3 29.7 2600 2017 3183 22.3 17.3 27.3 44243 40710 47776 Lewis County WA est14_WA.txt 06NOV2015 +53 43 1274 1002 1546 12.5 9.8 15.2 392 303 481 17.7 13.7 21.7 269 207 331 15.7 12.1 19.3 49955 45180 54730 Lincoln County WA est14_WA.txt 06NOV2015 +53 45 9040 7636 10444 15.6 13.2 18.0 2660 2093 3227 23.6 18.6 28.6 1805 1406 2204 22.4 17.4 27.4 52313 49305 55321 Mason County WA est14_WA.txt 06NOV2015 +53 47 9427 8024 10830 23.2 19.8 26.6 2969 2411 3527 31.5 25.6 37.4 1992 1578 2406 29.5 23.4 35.6 37782 34745 40819 Okanogan County WA est14_WA.txt 06NOV2015 +53 49 3606 2929 4283 17.8 14.5 21.1 965 775 1155 28.8 23.1 34.5 674 538 810 28.0 22.4 33.6 40189 36441 43937 Pacific County WA est14_WA.txt 06NOV2015 +53 51 2868 2398 3338 22.3 18.6 26.0 842 665 1019 33.1 26.2 40.0 588 463 713 30.2 23.8 36.6 42579 38373 46785 Pend Oreille County WA est14_WA.txt 06NOV2015 +53 53 106432 97890 114974 13.1 12.1 14.1 34165 30111 38219 17.5 15.4 19.6 22439 19462 25416 16.2 14.1 18.3 60397 58946 61848 Pierce County WA est14_WA.txt 06NOV2015 +53 55 2018 1729 2307 12.7 10.9 14.5 437 351 523 19.6 15.7 23.5 290 227 353 16.7 13.1 20.3 54721 50513 58929 San Juan County WA est14_WA.txt 06NOV2015 +53 57 18627 16409 20845 15.7 13.8 17.6 6124 5231 7017 23.2 19.8 26.6 3765 3106 4424 19.8 16.3 23.3 51395 48709 54081 Skagit County WA est14_WA.txt 06NOV2015 +53 59 1421 1099 1743 12.6 9.7 15.5 467 353 581 20.1 15.2 25.0 316 235 397 17.5 13.0 22.0 52673 47473 57873 Skamania County WA est14_WA.txt 06NOV2015 +53 61 73930 66931 80929 9.9 9.0 10.8 22598 19490 25706 13.1 11.3 14.9 14401 12105 16697 11.5 9.7 13.3 71890 70201 73579 Snohomish County WA est14_WA.txt 06NOV2015 +53 63 76910 70461 83359 16.3 14.9 17.7 21892 18858 24926 20.5 17.7 23.3 13976 11760 16192 18.2 15.3 21.1 50083 48190 51976 Spokane County WA est14_WA.txt 06NOV2015 +53 65 8368 7255 9481 19.3 16.7 21.9 2668 2169 3167 28.2 22.9 33.5 1773 1413 2133 24.5 19.5 29.5 43823 40849 46797 Stevens County WA est14_WA.txt 06NOV2015 +53 67 31197 27796 34598 11.9 10.6 13.2 9031 7502 10560 15.6 13.0 18.2 5706 4551 6861 13.7 10.9 16.5 61653 59047 64259 Thurston County WA est14_WA.txt 06NOV2015 +53 69 558 431 685 13.9 10.7 17.1 184 141 227 26.7 20.4 33.0 130 98 162 24.3 18.3 30.3 51022 48377 53667 Wahkiakum County WA est14_WA.txt 06NOV2015 +53 71 8682 7030 10334 15.7 12.7 18.7 2654 2046 3262 20.8 16.0 25.6 1762 1341 2183 19.1 14.6 23.6 49819 46459 53179 Walla Walla County WA est14_WA.txt 06NOV2015 +53 73 31842 28461 35223 15.7 14.0 17.4 7304 6146 8462 17.7 14.9 20.5 4888 4054 5722 16.4 13.6 19.2 53733 51153 56313 Whatcom County WA est14_WA.txt 06NOV2015 +53 75 11567 10634 12500 28.4 26.1 30.7 1181 938 1424 16.7 13.3 20.1 704 529 879 14.6 11.0 18.2 41837 37907 45767 Whitman County WA est14_WA.txt 06NOV2015 +53 77 50044 45009 55079 20.5 18.4 22.6 22000 19457 24543 30.3 26.8 33.8 14492 12596 16388 28.0 24.3 31.7 44342 42101 46583 Yakima County WA est14_WA.txt 06NOV2015 diff --git a/povertydata.py b/povertydata.py new file mode 100644 index 0000000..913ee3e --- /dev/null +++ b/povertydata.py @@ -0,0 +1,97 @@ +from operator import attrgetter + + +class CountyData: + def __init__(self, children_count, children_percentage, median_income, county_name): + self.children_count = children_count + self.children_percentage = children_percentage + self.median_income = median_income + self.county_name = county_name + + def print_data(self): + print self.county_name + print 'Percentage of Children in Poverty: %s' % self.children_percentage + print 'Number of Children in Poverty: %s' % self.children_count + print 'Median Household Income: %s' % self.median_income + +class StateData: + def __init__(self, state, state_data): + self.state = state + self.county_data = self.create_county_data(state_data) + + def create_county_data(self, state_data): + all_county_data = [] + for county in state_data: + children_count = county[49:56].strip() + children_percentage = county[76:81].strip() + median_income = county[133:139].strip() + county_name = county[193:238].strip() + county_data = CountyData(children_count, children_percentage, median_income, county_name) + all_county_data.append(county_data) + return all_county_data + + def lowest_percentage(self): + county = min(self.county_data,key=attrgetter('children_percentage')) + return county.print_data() + + def highest_percentage(self): + county = max(self.county_data,key=attrgetter('children_percentage')) + return county.print_data() + + def find_county(self, find_county): + find_county = find_county.replace(" County", "") + find_county = find_county.replace(" county", "") + for county in self.county_data: + county_name = county.county_name.replace(" County", "") + if county_name.lower() == find_county.lower(): + return county.print_data() + print "County Not Found" + + def print_counties(self): + for county in self.county_data: + print county.county_name + + +def check_user_input(input): + if input.upper() == "QUIT" or input.upper() == "Q": + exit() + else: + return input + + +print "\nWelcome to the US Poverty Data Portal" +print "\nEnter WA to view poverty data for Washington or OR to view poverty data for Oregon.\nEnter quit to exit the program at any time." +state = check_user_input(raw_input("> ")) + +state_file_path = None + +while state_file_path == None: + if state == "WA": + state_file_path = "est14_WA.txt" + elif state == "OR": + state_file_path = "est14_OR.txt" + else: + print "Invalid input. Please Enter WA for Washington or OR for Oregon" + state = check_user_input(raw_input("> ")) + +raw_state_data = open(state_file_path).read() +raw_state_data_list = raw_state_data.split('\n') +list_length = len(raw_state_data_list) +raw_state_data_list = raw_state_data_list[1:list_length - 1] +state_data = StateData(state, raw_state_data_list) + +print "STATE POVERTY DATA FOR %s" % state_data.state +print '\n' +print "County with highest percentage of childhood poverty:\n" +state_data.highest_percentage() +print "\n" +print "County with the lowest percentage of childhood poverty:\n" +state_data.lowest_percentage() +print "\n" +print "Enter a county name to learn more about a specific county.\nEnter quit to exit the program at any time.\nPress ENTER for a list of all counties" +while True: + county_name = check_user_input(raw_input("> ")) + if county_name == "": + state_data.print_counties() + else: + state_data.find_county(county_name)