Skip to content

usdeathspy

A Python package for scraping and accessing CDC Vital Statistics data.

Installation

pip install usdeathspy

Quick Start

Load the pre-scraped CDC Vital Statistics dataset bundled with the package:

from usdeathspy import load_cdc_data

df = load_cdc_data()
print(df)

Or scrape fresh data directly from the CDC:

from usdeathspy import scrape_all_sections

df = scrape_all_sections(
    url     = "https://www.cdc.gov/nchs/data_access/VitalStatsOnline.htm",
    url_pdf = "https://www.cdc.gov/nchs/nvss/mortality_public_use_data.htm"
)

Documentation

See the API page for full function documentation.