Skip to content

load_reports

Load Prevention of Future Death reports as a DataFrame.

Parameters:

Name Type Description Default
start_date str

Inclusive lower bound for the report date in YYYY-MM-DD format. Defaults to "2000-01-01".

'2000-01-01'
end_date str

Inclusive upper bound for the report date in YYYY-MM-DD format. Defaults to "2050-01-01".

'2050-01-01'
n_reports int or None

Keep only the most recent n_reports rows after filtering by date. None (the default) returns all rows.

None
refresh bool

If True, force a fresh download of the dataset instead of using the cached copy. Defaults to False.

False

Returns:

Type Description
DataFrame

Reports filtered by date, sorted newest first and optionally limited to n_reports rows.

Raises:

Type Description
ValueError

If start_date is after end_date.

FileNotFoundError

If the dataset cannot be downloaded.

Examples:

from pfd_toolkit import load_reports
df = load_reports(start_date="2020-01-01", end_date="2022-12-31", n_reports=100)
df.head()