{"id":1746,"date":"2013-08-12T03:11:19","date_gmt":"2013-08-12T03:11:19","guid":{"rendered":"http:\/\/garysieling.com\/blog\/?p=1746"},"modified":"2013-08-12T03:11:19","modified_gmt":"2013-08-12T03:11:19","slug":"counting-presidential-signatures-in-u-s-law","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/counting-presidential-signatures-in-u-s-law\/","title":{"rendered":"Counting Presidential Signatures in U.S. Law with Python"},"content":{"rendered":"<p>Browsing through U.S Law, I noticed that there are many notes- e.g. memos to Federal employees and executive orders. In some cases these have a signature block, which shows who wrote the document. Most, but not all, are written by presidents. I suspect that either the inclusion of these records in U.S. Law (or at least the signatures) is relatively modern, as the oldest person with multiple signatures is Harry Truman- these are somewhat, but not entirely chronological.<\/p>\n<pre>\nBarack Obama: 183\nWilliam J. Clinton: 159\nGeorge W. Bush: 147\nJimmy Carter: 65\nRonald Reagan: 59\nGeorge Bush: 55 \nRichard Nixon: 37\nDwight D. Eisenhower: 32\nLyndon B. Johnson: 28\nGerald R. Ford: 17\nHarry S Truman: 13 \nJohn F. Kennedy: 10\nHarry S. Truman: 7\nFranklin D. Roosevelt: 4\nFred M. Vinson: 1\nHalifax.: 1\nNancy Pelosi: 1\nWm. H. Taft.: 1\nRobert F. Kennedy: 1\nBy Alexander C. Hoffman: 1\nFranklin D Roosevelt: 1\nRobert C. Byrd: 1\nBy Sheldon Elliott Steinbach: 1\nEdward DLG. Pangelinan': 1\nBy Irwin Karp: 1 \nAmbassador F. Haydn Williams: 1\nRobert S. McNamara: 1\nJ. C. Lambert: 1\n<\/pre>\n<p>This output can be easily generated in Python, like so:<\/p>\n<pre lang=\"python\">\nall_signatures = []\ndef findElements(xpath, urls):\n  for root, dirs, files in os.walk(dir):\n    for f in files:\n      if f.endswith('.xml'):\n        tree = ET.parse(dir + \"\\\\\" + f)\n        namepath = '.\/\/{http:\/\/xml.house.gov\/schemas\/uslm\/1.0}name'\n        sigpath = '.\/\/{http:\/\/xml.house.gov\/schemas\/uslm\/1.0}signature'\n        signatures = \n           [n.find(namepath).text \\ \n           for n in tree.findall(sigpath)]\n        print(f)\n        print(Counter(signatures))\n        all_signatures = all_signatures + signatures\n\nprint(\"All:\")\nprint(Counter(all_signatures))\n<\/pre>\n<p>The distribution of these is interesting as well, as certain titles are represented much more than others (it would be best to normalize these by the length or age of the title, although that may be less useful given the recency bias of the signatures).<\/p>\n<p>The two largest (Title 22, Title 42) are &#8220;Foreign Relations and Intercourse&#8221; and &#8220;The Public Health and Welfare&#8221;.<\/p>\n<pre>\nTitle 01: 3 memos\nTitle 02: 10 memos\nTitle 03: 24 memos\nTitle 04: 2 memos\nTitle 05: 87 memos\nTitle 06: 14 memos\nTitle 07: 17 memos\nTitle 08: 19 memos\nTitle 09: 0 memos\nTitle 10: 36 memos\nTitle 11: 0 memos\nTitle 12: 9 memos\nTitle 13: 0 memos\nTitle 14: 0 memos\nTitle 15: 48 memos\nTitle 16: 27 memos\nTitle 17: 5 memos\nTitle 18: 10 memos\nTitle 19: 40 memos\nTitle 20: 16 memos\nTitle 21: 5 memos\nTitle 22: 114 memos\nTitle 23: 3 memos\nTitle 24: 1 memos\nTitle 25: 5 memos\nTitle 26: 8 memos\nTitle 27: 0 memos\nTitle 28: 14 memos\nTitle 29: 11 memos\nTitle 30: 1 memos\nTitle 31: 28 memos\nTitle 32: 2 memos\nTitle 33: 10 memos\nTitle 35: 1 memos\nTitle 36: 8 memos\nTitle 37: 2 memos\nTitle 38: 8 memos\nTitle 39: 2 memos\nTitle 40: 12 memos\nTitle 41: 14 memos\nTitle 42: 122 memos\nTitle 43: 6 memos\nTitle 44: 6 memos\nTitle 45: 1 memos\nTitle 46: 1 memos\nTitle 47: 5 memos\nTitle 48: 20 memos\nTitle 49: 19 memos\nTitle 50: 33 memos\nTitle 51: 6 memos\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Browsing through U.S Law, I noticed that there are many notes- e.g. memos to Federal employees and executive orders. In some cases these have a signature block, which shows who wrote the document. Most, but not all, are written by presidents. I suspect that either the inclusion of these records in U.S. Law (or at &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/counting-presidential-signatures-in-u-s-law\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Counting Presidential Signatures in U.S. Law with Python&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[335,447],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/1746"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=1746"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/1746\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=1746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=1746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=1746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}