pyvoteview


Namepyvoteview JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryPyVoteview package to process VoteView site data.
upload_time2025-09-13 03:32:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords voteview congress politics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyVoteview

PyVoteview is a Python package for programmatically accessing and analyzing U.S. Congressional voting records from [Voteview](https://voteview.com/). 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](https://pola.rs/):

```sh
pip install pyvoteview
```

## Quick Start

```python
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.<br>`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](https://voteview.com/articles/data_help_votes)).
- `PARTY_CODES_MAP`: Maps integer party codes to party names (see [Voteview enumeration](https://voteview.com/articles/data_help_parties)).


## License

Licensed under the [Apache License 2.0](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyvoteview",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "voteview, congress, politics",
    "author": null,
    "author_email": "Jeremy Kazimer <jeremykazimer@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b9/3e/84572043807902ce98c1d36f46bbcf16ca3eba874aa6ab4a9427eb6f7dd4/pyvoteview-0.3.0.tar.gz",
    "platform": null,
    "description": "# PyVoteview\n\nPyVoteview is a Python package for programmatically accessing and analyzing U.S. Congressional voting records from [Voteview](https://voteview.com/). It provides a simple interface to retrieve, filter, and process roll call data for both the House and Senate across sessions and years.\n\n## Features\n\n- Fetch voting records by Congress number or year\n- Retrieve data for a range of sessions or years\n- Fast, parallelized data loading using Polars and ThreadPoolExecutor\n\n\n## Installation\n\nPyVoteview requires Python 3.11+ and [Polars](https://pola.rs/):\n\n```sh\npip install pyvoteview\n```\n\n## Quick Start\n\n```python\nfrom pyvoteview.core import get_records_by_congress, get_records_by_year\n\n# Get House voting records for the 117th Congress\ndf = get_records_by_congress(117, \"House\")\n\n# Get Senate voting records for the year 2020\ndf = get_records_by_year(2020, \"Senate\")\n\n# Get records for a range of sessions\ndf_range = get_records_by_congress_range(115, 117, \"House\")\n```\n\nAll functions return a Polars `DataFrame`.\n\n## API Reference\n\n### Fetching Voting Records\n\n| Function | Description | Returns |\n|----------|-------------|---------|\n| `get_records_by_congress(number: int, chamber: Literal[\"House\", \"Senate\"])` | Fetch roll call records for a specific Congress and chamber. | Polars `DataFrame` |\n| `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` |\n| `get_records_by_year(year: int, chamber: Literal[\"House\", \"Senate\"])` | Fetch records for a specific year. | Polars `DataFrame` |\n| `get_records_by_year_range(start_year: int, end_year: int, chamber: Literal[\"House\", \"Senate\"])` | Fetch records across multiple years. | Polars `DataFrame` |\n\n### Data Processing\n\n| Function | Description | Parameters |\n|----------|-------------|------------|\n| `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.<br>`overwrite_party_code`: overwrite `party_code` column if True. |\n\n### Mappings\n\n- `CAST_CODES_MAP`: Maps integer roll call codes to human-readable descriptions\n  (see [Voteview enumeration](https://voteview.com/articles/data_help_votes)).\n- `PARTY_CODES_MAP`: Maps integer party codes to party names (see [Voteview enumeration](https://voteview.com/articles/data_help_parties)).\n\n\n## License\n\nLicensed under the [Apache License 2.0](LICENSE).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "PyVoteview package to process VoteView site data.",
    "version": "0.3.0",
    "project_urls": {
        "source": "https://github.com/k-z-m-r/PyVoteview"
    },
    "split_keywords": [
        "voteview",
        " congress",
        " politics"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "535629c11b67f77e3f9e5ffc6a71b19f13f9b532686f60d5bb5f2957d82550f0",
                "md5": "af3668ae72cfc45348ccebbf4baea5c4",
                "sha256": "52bb9fda83e65db9f4daafb42ea72d7191444de09262ac22d0ee56b5b641768e"
            },
            "downloads": -1,
            "filename": "pyvoteview-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "af3668ae72cfc45348ccebbf4baea5c4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 11471,
            "upload_time": "2025-09-13T03:32:34",
            "upload_time_iso_8601": "2025-09-13T03:32:34.346114Z",
            "url": "https://files.pythonhosted.org/packages/53/56/29c11b67f77e3f9e5ffc6a71b19f13f9b532686f60d5bb5f2957d82550f0/pyvoteview-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b93e84572043807902ce98c1d36f46bbcf16ca3eba874aa6ab4a9427eb6f7dd4",
                "md5": "3db4e4ddb00a1cdb84c15ce3307b48ca",
                "sha256": "cf0c2152912b9797b120aae4234805c55edd466399a241a839db4cf62397eb8b"
            },
            "downloads": -1,
            "filename": "pyvoteview-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3db4e4ddb00a1cdb84c15ce3307b48ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 11244,
            "upload_time": "2025-09-13T03:32:35",
            "upload_time_iso_8601": "2025-09-13T03:32:35.843292Z",
            "url": "https://files.pythonhosted.org/packages/b9/3e/84572043807902ce98c1d36f46bbcf16ca3eba874aa6ab4a9427eb6f7dd4/pyvoteview-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-13 03:32:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "k-z-m-r",
    "github_project": "PyVoteview",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyvoteview"
}
        
Elapsed time: 1.85771s