Skip to main content

Obtain historical US presidential election data

Project description

pyelection

Presidential election data collector in Python

Installation

pip install pyelection

Example: 2016 US Presidential

from pyelection import PyElection
pye = PyElection(2016)

By state

import json
state = pye.get_state_summary()
json.dumps(state, indent=4, sort_keys=True)

By candidate

import pandas as pd # need to install pandas
candidates = pye.get_candiate_summary()
pd.DataFrame(candidates)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyelection-0.0.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page