Skip to main content

PyVoteview package to process VoteView site data.

Project description

PyVoteview

PyVoteview is a Python package for programmatically accessing and analyzing U.S. Congressional voting records from Voteview. It provides a simple interface to retrieve, filter, and process roll call data for both the House and Senate across sessions and years.

Features

  • Fetch voting records by Congress number or year
  • Retrieve data for a range of sessions or years
  • Fast, parallelized data loading using Polars and ThreadPoolExecutor

Installation

PyVoteview requires Python 3.11+ and Polars:

pip install pyvoteview

Quick Start

from pyvoteview.core import get_records_by_congress, get_records_by_year

# Get House voting records for the 117th Congress
df = get_records_by_congress(117, "House")

# Get Senate voting records for the year 2020
df = get_records_by_year(2020, "Senate")

# Get records for a range of sessions
df_range = get_records_by_congress_range(115, 117, "House")

All functions return a Polars DataFrame.

API Reference

Fetching Voting Records

Function Description Returns
get_records_by_congress(number: int, chamber: Literal["House", "Senate"]) Fetch roll call records for a specific Congress and chamber. Polars DataFrame
get_records_by_congress_range(start_congress_number: int, end_congress_number: int, chamber: Literal["House", "Senate"]) Fetch records for a range of Congress sessions. Polars DataFrame
get_records_by_year(year: int, chamber: Literal["House", "Senate"]) Fetch records for a specific year. Polars DataFrame
get_records_by_year_range(start_year: int, end_year: int, chamber: Literal["House", "Senate"]) Fetch records across multiple years. Polars DataFrame

Data Processing

Function Description Parameters
rename_columns(record: DataFrame, overwrite_cast_code: bool = True, overwrite_party_code: bool = True) Replace numeric codes with descriptive labels for cast and party codes. overwrite_cast_code: overwrite cast_code column if True.
overwrite_party_code: overwrite party_code column if True.

Mappings

License

Licensed under the Apache License 2.0.

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

pyvoteview-0.3.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyvoteview-0.3.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file pyvoteview-0.3.0.tar.gz.

File metadata

  • Download URL: pyvoteview-0.3.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyvoteview-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cf0c2152912b9797b120aae4234805c55edd466399a241a839db4cf62397eb8b
MD5 3db4e4ddb00a1cdb84c15ce3307b48ca
BLAKE2b-256 b93e84572043807902ce98c1d36f46bbcf16ca3eba874aa6ab4a9427eb6f7dd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoteview-0.3.0.tar.gz:

Publisher: python-publish.yml on k-z-m-r/PyVoteview

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvoteview-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyvoteview-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyvoteview-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52bb9fda83e65db9f4daafb42ea72d7191444de09262ac22d0ee56b5b641768e
MD5 af3668ae72cfc45348ccebbf4baea5c4
BLAKE2b-256 535629c11b67f77e3f9e5ffc6a71b19f13f9b532686f60d5bb5f2957d82550f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvoteview-0.3.0-py3-none-any.whl:

Publisher: python-publish.yml on k-z-m-r/PyVoteview

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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