Skip to content

ciyer/python-pollster

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pollster

A Python wrapper for the Pollster API which provides access to political opinion polling data and trend estimates from The Huffington Post.

Installation

pip install pollster

Getting started

from pollster import Pollster
pollster = Pollster()

See the current estimate of the president's job approval

chart = pollster.charts(topic='obama-job-approval')[0]
chart.estimate()

List charts about 2012 Senate races

pollster.charts(topic='2012-senate')

List charts about Wisconsin

pollster.charts(state='WI')

Calculate the margin between Obama and Romney from a recent general election poll

poll = pollster.polls(chart='2012-general-election-romney-vs-obama')[0]
question = [x['subpopulations'][0] for x in poll.questions if x['chart'] == '2012-general-election-romney-vs-obama'][0]
obama = [x for x in question['responses'] if x['choice'] == 'Obama'][0]
romney = [x for x in question['responses'] if x['choice'] == 'Romney'][0]
obama['value'] - romney['value']

See the methodology used in recent polls about the Affordable Care Act

chart = pollster.chart(slug='us-health-bill')
[[x.pollster, x.method] for x in chart.polls()]

Authors

Copyright

Copyright © 2012 The Huffington Post. See LICENSE for details.

About

A Python wrapper for the Pollster API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%