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
CAST_CODES_MAP: Maps integer roll call codes to human-readable descriptions (see Voteview enumeration).PARTY_CODES_MAP: Maps integer party codes to party names (see Voteview enumeration).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf0c2152912b9797b120aae4234805c55edd466399a241a839db4cf62397eb8b
|
|
| MD5 |
3db4e4ddb00a1cdb84c15ce3307b48ca
|
|
| BLAKE2b-256 |
b93e84572043807902ce98c1d36f46bbcf16ca3eba874aa6ab4a9427eb6f7dd4
|
Provenance
The following attestation bundles were made for pyvoteview-0.3.0.tar.gz:
Publisher:
python-publish.yml on k-z-m-r/PyVoteview
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvoteview-0.3.0.tar.gz -
Subject digest:
cf0c2152912b9797b120aae4234805c55edd466399a241a839db4cf62397eb8b - Sigstore transparency entry: 509756227
- Sigstore integration time:
-
Permalink:
k-z-m-r/PyVoteview@862958f61411f79254d92b0f4b231fa5765be73f -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/k-z-m-r
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@862958f61411f79254d92b0f4b231fa5765be73f -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52bb9fda83e65db9f4daafb42ea72d7191444de09262ac22d0ee56b5b641768e
|
|
| MD5 |
af3668ae72cfc45348ccebbf4baea5c4
|
|
| BLAKE2b-256 |
535629c11b67f77e3f9e5ffc6a71b19f13f9b532686f60d5bb5f2957d82550f0
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvoteview-0.3.0-py3-none-any.whl -
Subject digest:
52bb9fda83e65db9f4daafb42ea72d7191444de09262ac22d0ee56b5b641768e - Sigstore transparency entry: 509756267
- Sigstore integration time:
-
Permalink:
k-z-m-r/PyVoteview@862958f61411f79254d92b0f4b231fa5765be73f -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/k-z-m-r
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@862958f61411f79254d92b0f4b231fa5765be73f -
Trigger Event:
release
-
Statement type: