In [1]:
import yaml
stream = open('author-mapping/legislators-current.yaml', 'rb')
stream_historical = open('author-mapping/legislators-historical.yaml', 'rb')
In [2]:
current = list(yaml.load(stream))
historical = list(yaml.load(stream_historical))
current.extend(historical)
In [18]:
joined = [author for author in current if 'votesmart' in author['id'].keys()]
In [20]:
with open('votesmart.yml', 'w') as outfile:
outfile.write(yaml.dump(joined, default_flow_style=True))
In [21]:
joined[:5]
Out[21]:
[{'bio': {'birthday': '1952-11-09', 'gender': 'M', 'religion': 'Lutheran'},
'id': {'ballotpedia': 'Sherrod Brown',
'bioguide': 'B000944',
'cspan': 5051,
'fec': ['H2OH13033', 'S6OH00163'],
'govtrack': 400050,
'house_history': 9996,
'icpsr': 29389,
'lis': 'S307',
'maplight': 7573,
'opensecrets': 'N00003535',
'thomas': '00136',
'votesmart': 27018,
'washington_post': 'gIQA3O2w9O',
'wikipedia': 'Sherrod Brown'},
'name': {'first': 'Sherrod',
'last': 'Brown',
'official_full': 'Sherrod Brown'},
'terms': [{'district': 13,
'end': '1994-12-01',
'party': 'Democrat',
'start': '1993-01-05',
'state': 'OH',
'type': 'rep'},
{'district': 13,
'end': '1996-10-04',
'party': 'Democrat',
'start': '1995-01-04',
'state': 'OH',
'type': 'rep'},
{'district': 13,
'end': '1998-12-19',
'party': 'Democrat',
'start': '1997-01-07',
'state': 'OH',
'type': 'rep'},
{'district': 13,
'end': '2000-12-15',
'party': 'Democrat',
'start': '1999-01-06',
'state': 'OH',
'type': 'rep'},
{'district': 13,
'end': '2002-11-22',
'party': 'Democrat',
'start': '2001-01-03',
'state': 'OH',
'type': 'rep'},
{'district': 13,
'end': '2004-12-09',
'party': 'Democrat',
'start': '2003-01-07',
'state': 'OH',
'type': 'rep',
'url': 'http://www.house.gov/sherrodbrown'},
{'district': 13,
'end': '2006-12-09',
'party': 'Democrat',
'start': '2005-01-04',
'state': 'OH',
'type': 'rep',
'url': 'http://www.house.gov/sherrodbrown'},
{'address': '713 HART SENATE OFFICE BUILDING WASHINGTON DC 20510',
'class': 1,
'contact_form': 'http://www.brown.senate.gov/contact/',
'end': '2013-01-03',
'fax': '202-228-6321',
'office': '713 Hart Senate Office Building',
'party': 'Democrat',
'phone': '202-224-2315',
'start': '2007-01-04',
'state': 'OH',
'type': 'sen',
'url': 'http://brown.senate.gov/'},
{'address': '713 Hart Senate Office Building Washington DC 20510',
'class': 1,
'contact_form': 'http://www.brown.senate.gov/contact/',
'end': '2019-01-03',
'fax': '202-228-6321',
'office': '713 Hart Senate Office Building',
'party': 'Democrat',
'phone': '202-224-2315',
'rss_url': 'http://www.brown.senate.gov/rss/feeds/?type=all&',
'start': '2013-01-03',
'state': 'OH',
'state_rank': 'senior',
'type': 'sen',
'url': 'http://www.brown.senate.gov'}]},
{'bio': {'birthday': '1958-10-13',
'gender': 'F',
'religion': 'Roman Catholic'},
'id': {'ballotpedia': 'Maria Cantwell',
'bioguide': 'C000127',
'cspan': 26137,
'fec': ['S8WA00194', 'H2WA01054'],
'govtrack': 300018,
'house_history': 10608,
'icpsr': 39310,
'lis': 'S275',
'maplight': 4541,
'opensecrets': 'N00007836',
'thomas': '00172',
'votesmart': 27122,
'washington_post': 'gIQAZxKkDP',
'wikipedia': 'Maria Cantwell'},
'name': {'first': 'Maria',
'last': 'Cantwell',
'official_full': 'Maria Cantwell'},
'terms': [{'district': 1,
'end': '1994-12-01',
'party': 'Democrat',
'start': '1993-01-05',
'state': 'WA',
'type': 'rep'},
{'class': 1,
'end': '2006-12-09',
'party': 'Democrat',
'start': '2001-01-03',
'state': 'WA',
'type': 'sen',
'url': 'http://cantwell.senate.gov'},
{'address': '311 HART SENATE OFFICE BUILDING WASHINGTON DC 20510',
'class': 1,
'contact_form': 'http://www.cantwell.senate.gov/contact/',
'end': '2013-01-03',
'fax': '202-228-0514',
'office': '311 Hart Senate Office Building',
'party': 'Democrat',
'phone': '202-224-3441',
'start': '2007-01-04',
'state': 'WA',
'type': 'sen',
'url': 'http://cantwell.senate.gov'},
{'address': '311 Hart Senate Office Building Washington DC 20510',
'class': 1,
'contact_form': 'http://www.cantwell.senate.gov/public/index.cfm/email-maria',
'end': '2019-01-03',
'fax': '202-228-0514',
'office': '311 Hart Senate Office Building',
'party': 'Democrat',
'phone': '202-224-3441',
'rss_url': 'http://www.cantwell.senate.gov/public/index.cfm/rss/feed',
'start': '2013-01-03',
'state': 'WA',
'state_rank': 'junior',
'type': 'sen',
'url': 'http://www.cantwell.senate.gov'}]},
{'bio': {'birthday': '1943-10-05', 'gender': 'M', 'religion': 'Jewish'},
'id': {'ballotpedia': 'Ben Cardin',
'bioguide': 'C000141',
'cspan': 4004,
'fec': ['H6MD03177', 'S6MD03177'],
'govtrack': 400064,
'house_history': 10629,
'icpsr': 15408,
'lis': 'S308',
'maplight': 7556,
'opensecrets': 'N00001955',
'thomas': '00174',
'votesmart': 26888,
'washington_post': 'gIQAGMu99O',
'wikipedia': 'Ben Cardin'},
'name': {'first': 'Benjamin',
'last': 'Cardin',
'middle': 'L.',
'official_full': 'Benjamin L. Cardin'},
'terms': [{'district': 3,
'end': '1988-10-22',
'party': 'Democrat',
'start': '1987-01-06',
'state': 'MD',
'type': 'rep'},
{'district': 3,
'end': '1990-10-28',
'party': 'Democrat',
'start': '1989-01-03',
'state': 'MD',
'type': 'rep'},
{'district': 3,
'end': '1992-10-09',
'party': 'Democrat',
'start': '1991-01-03',
'state': 'MD',
'type': 'rep'},
{'district': 3,
'end': '1994-12-01',
'party': 'Democrat',
'start': '1993-01-05',
'state': 'MD',
'type': 'rep'},
{'district': 3,
'end': '1996-10-04',
'party': 'Democrat',
'start': '1995-01-04',
'state': 'MD',
'type': 'rep'},
{'district': 3,
'end': '1998-12-19',
'party': 'Democrat',
'start': '1997-01-07',
'state': 'MD',
'type': 'rep'},
{'district': 3,
'end': '2000-12-15',
'party': 'Democrat',
'start': '1999-01-06',
'state': 'MD',
'type': 'rep'},
{'district': 3,
'end': '2002-11-22',
'party': 'Democrat',
'start': '2001-01-03',
'state': 'MD',
'type': 'rep'},
{'district': 3,
'end': '2004-12-09',
'party': 'Democrat',
'start': '2003-01-07',
'state': 'MD',
'type': 'rep',
'url': 'http://www.house.gov/cardin'},
{'district': 3,
'end': '2006-12-09',
'party': 'Democrat',
'start': '2005-01-04',
'state': 'MD',
'type': 'rep',
'url': 'http://www.house.gov/cardin'},
{'address': '509 HART SENATE OFFICE BUILDING WASHINGTON DC 20510',
'class': 1,
'contact_form': 'http://www.cardin.senate.gov/contact/',
'end': '2013-01-03',
'fax': '202-224-1651',
'office': '509 Hart Senate Office Building',
'party': 'Democrat',
'phone': '202-224-4524',
'start': '2007-01-04',
'state': 'MD',
'type': 'sen',
'url': 'http://cardin.senate.gov/'},
{'address': '509 Hart Senate Office Building Washington DC 20510',
'class': 1,
'contact_form': 'http://www.cardin.senate.gov/contact/',
'end': '2019-01-03',
'fax': '202-224-1651',
'office': '509 Hart Senate Office Building',
'party': 'Democrat',
'phone': '202-224-4524',
'rss_url': 'http://www.cardin.senate.gov/rss/feeds/?type=all',
'start': '2013-01-03',
'state': 'MD',
'state_rank': 'junior',
'type': 'sen',
'url': 'http://www.cardin.senate.gov'}]},
{'bio': {'birthday': '1947-01-23', 'gender': 'M', 'religion': 'Presbyterian'},
'id': {'ballotpedia': 'Tom Carper',
'bioguide': 'C000174',
'cspan': 663,
'fec': ['S8DE00079'],
'govtrack': 300019,
'house_history': 10671,
'icpsr': 15015,
'lis': 'S277',
'maplight': 4542,
'opensecrets': 'N00012508',
'thomas': '00179',
'votesmart': 22421,
'washington_post': 'gIQA3bm69O',
'wikipedia': 'Tom Carper'},
'name': {'first': 'Thomas',
'last': 'Carper',
'middle': 'Richard',
'official_full': 'Thomas R. Carper'},
'terms': [{'district': 0,
'end': '1984-10-12',
'party': 'Democrat',
'start': '1983-01-03',
'state': 'DE',
'type': 'rep'},
{'district': 0,
'end': '1986-10-18',
'party': 'Democrat',
'start': '1985-01-03',
'state': 'DE',
'type': 'rep'},
{'district': 0,
'end': '1988-10-22',
'party': 'Democrat',
'start': '1987-01-06',
'state': 'DE',
'type': 'rep'},
{'district': 0,
'end': '1990-10-28',
'party': 'Democrat',
'start': '1989-01-03',
'state': 'DE',
'type': 'rep'},
{'district': 0,
'end': '1992-10-09',
'party': 'Democrat',
'start': '1991-01-03',
'state': 'DE',
'type': 'rep'},
{'class': 1,
'end': '2006-12-09',
'party': 'Democrat',
'start': '2001-01-03',
'state': 'DE',
'type': 'sen',
'url': 'http://carper.senate.gov'},
{'address': '513 HART SENATE OFFICE BUILDING WASHINGTON DC 20510',
'class': 1,
'contact_form': 'http://www.carper.senate.gov/contact/',
'end': '2013-01-03',
'fax': '202-228-2190',
'office': '513 Hart Senate Office Building',
'party': 'Democrat',
'phone': '202-224-2441',
'start': '2007-01-04',
'state': 'DE',
'type': 'sen',
'url': 'http://carper.senate.gov'},
{'address': '513 Hart Senate Office Building Washington DC 20510',
'class': 1,
'contact_form': 'http://carper.senate.gov/public/index.cfm/email-senator-carper',
'end': '2019-01-03',
'fax': '202-228-2190',
'office': '513 Hart Senate Office Building',
'party': 'Democrat',
'phone': '202-224-2441',
'rss_url': 'http://www.carper.senate.gov/public/index.cfm/rss/feed',
'start': '2013-01-03',
'state': 'DE',
'state_rank': 'senior',
'type': 'sen',
'url': 'http://www.carper.senate.gov'}]},
{'bio': {'birthday': '1960-04-13', 'gender': 'M'},
'id': {'ballotpedia': 'Bob Casey, Jr.',
'bioguide': 'C001070',
'cspan': 47036,
'fec': ['S6PA00217'],
'govtrack': 412246,
'icpsr': 40703,
'lis': 'S309',
'maplight': 4724,
'opensecrets': 'N00027503',
'thomas': '01828',
'votesmart': 2541,
'washington_post': 'gIQABeor9O',
'wikipedia': 'Bob Casey, Jr.'},
'name': {'first': 'Robert',
'last': 'Casey',
'middle': 'P.',
'nickname': 'Bob',
'official_full': 'Robert P. Casey, Jr.',
'suffix': 'Jr.'},
'terms': [{'address': '393 RUSSELL SENATE OFFICE BUILDING WASHINGTON DC 20510',
'class': 1,
'contact_form': 'http://www.casey.senate.gov/contact/',
'end': '2013-01-03',
'fax': '202-228-0604',
'office': '393 Russell Senate Office Building',
'party': 'Democrat',
'phone': '202-224-6324',
'start': '2007-01-04',
'state': 'PA',
'type': 'sen',
'url': 'http://casey.senate.gov/'},
{'address': '393 Russell Senate Office Building Washington DC 20510',
'class': 1,
'contact_form': 'http://www.casey.senate.gov/contact/',
'end': '2019-01-03',
'fax': '202-228-0604',
'office': '393 Russell Senate Office Building',
'party': 'Democrat',
'phone': '202-224-6324',
'rss_url': 'http://www.casey.senate.gov/rss/feeds/?all',
'start': '2013-01-03',
'state': 'PA',
'state_rank': 'senior',
'type': 'sen',
'url': 'http://www.casey.senate.gov'}]}]
In [ ]:
Content source: dcalacci/talk-like-a-congressperson
Similar notebooks: