Reference: Other Functionality¶
Parsing data sources for COVID-19¶
Currently, two simple parsers are implemented to collect United States data.
More parsers can be added straightforwardly by subclassing
pydemic.data.DataParser
.
-
pydemic.data.united_states.
covid_tracking
(region=None)[source]¶ Returns state-level data as collected by the COVID Tracking Project.
- Parameters
region – The state whose data shall be returned. May be specified by abbreviation or by full name. Defaults to None, in which all data (grouped by state) is returned.
- Returns
-
pydemic.data.united_states.
nyt
(region=None)[source]¶ Returns state-level COVID-19 data as collected by the New York Times.
- Parameters
region – The state whose data shall be returned. May be specified by abbreviation or by full name. Defaults to None, in which all data (grouped by state) is returned.
- Returns
-
pydemic.data.united_states.
get_population
(region=None)[source]¶ - Parameters
region – The region whose shall be returned. May be specified by abbreviation or by full name. Defaults to None, in which case the entire population of the United States is returned.
- Returns
The population of
region
.
-
pydemic.data.united_states.
get_age_distribution
(region=None)[source]¶ Returns the age distribution, stratified into the bins \([0, 10)\), \([10, 20)\), …, \([70, 80)\), and \([80, \inf)\).
- Parameters
region – The region whose shall be returned. May be specified by abbreviation or by full name. Currently, this argument is ignored and the aggregated age distribution of the United States is returned.
- Returns
The United States age distribution (a
numpy.ndarray
).