chimeric_tools.Data¶
Classes to keep data up to date
- chimeric_tools.Data.check_for_data(filename: str) bool ¶
Check to see if a file exists
- Parameters:
path (str path to the file that is being checked) –
- chimeric_tools.Data.covid_data(start_date: date | str | None = None, end_date: date | str | None = None, geo_values: ndarray | list | str | None = None, include: list | None = None, preds: bool = True)¶
Processes Covid Data
- Parameters:
start_date (date or str) – The first day to include in the data set. If the date is before the first day in the raw dataset then start_date will be set the first day available. Since this function returns weekly data, if you input a start date in the middel of the week it will be rounded to the nearest week.
end_date (date or str) – The last day to include in the data set. If the date is after the last day in the raw dataset then end_date will be set the last day available. Since this function returns weekly data, if you input a end date in the middel of the week it will be rounded to the nearest week.
geo_values (np.ndarray or list or str) – list of locations to be returned in the dataset. If None, all locations are returned. All states must be in number FIPS terms ex. (PA would be “42”). All counties bust be be in their statndard FIP format of state number and county number ex. (Northhampton County would be”42095”).
include (list) – list of data you want to include in the dataset. If None, all data is included. You can include cases, deaths, and hospitalizations.
- Returns:
Dataframe of Covid data
- Return type:
pd.DataFrame
Examples
>>> from chimeric_tools.Data import covid_data >>> data = covid_data(start_date = "2021-01-01", end_date = "2021-12-31", geo_values = "US", include = ["cases", "deaths", "hosps"]) >>> data.head()
- chimeric_tools.Data.daily_to_weekly(data)¶
Converts daily data into weekly data by summing all cases for that week. Dataframe must be in format [ date: date or str, location: str, location_name, str, value: int or float]
- Parameters:
data (pd.DataFrame) – The columns must of of name [ date: date or str, location: str, location_name, str, value: int or float]
- Return type:
Dataframe of weekly cases for each location
- chimeric_tools.Data.download_from_github(filename) None ¶
Downloads files from github and saves them to the data folder
- Parameters:
url (str) – url to the file to be downloaded
- chimeric_tools.Data.load_cases_truths()¶
Loads raw case truths from CSSE dataset
- Return type:
dataframe
- chimeric_tools.Data.load_cases_weekly()¶
Load weekly cases complete with ARIMA(2,1,0) predictions and residuals
- Return type:
dataframe
- chimeric_tools.Data.load_deaths_truths()¶
Loads raw death truths from CSSE dataset
- Return type:
dataframe
- chimeric_tools.Data.load_deaths_weekly()¶
Load weekly deaths complete with ARIMA(2,1,0) predictions and residuals
- Return type:
dataframe
- chimeric_tools.Data.load_file(filename)¶
Loads a file from local or downloads from github and streams data
- Return type:
dataframe
- chimeric_tools.Data.load_hosps_truths()¶
Loads raw hosp truths from CSSE dataset
- Return type:
dataframe
- chimeric_tools.Data.load_hosps_weekly()¶
Load weekly hosps complete with ARIMA(2,1,0) predictions and residuals
- Return type:
dataframe