Package: pycovid
PyCOVID PackageThe PyCOVID package provides a Pandas Dataframe of the 2019 Novel Coronavirus COVID-19 (2019-nCoV) epidemic based on Rami Krispin's 'coronavirus' package in R. The raw data pulled from the Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE) CoronavirusTry in a collaboratory iPython notebookQuick InstallationpipinstallpycovidImportingfrompycovidimportpycovidpycovid.getCovidCases()Value AdditionThe 'coronavirus' R package gets access to data, but the 'pyCOVID' package builts some additional functionality over it.Wide Format for quicker analysis (Wide by case type - Confirmed/Death/Recovered)Filtering options - By country, timeline, casetypeCumulative Aggregating options - cumsum parameter to look at the cumulative totals of how the Coronavirus has grown over timeTime Resampling: Converts dataframe to time-indexed, and resamples at required time level (weekly, monthly, etc)Quick visualization using Plotly: Use the plotCountries() functionUsagegetCovidCasesWide(): Get the wide version of the Coronavirus Dataset
Parameters:Countries: List of Countries (Default: All Countries)start_date and end_date: Use these to set the time window you wish to accesscasetype: Python List of Case Types ('confirmed', 'death' and 'recovered' and Default is all)cumsum: Gets cumulative sums of cases for each country in list (Default: False)getCovidCases(): Get the Rami Krispin Coronavirus Dataset in the original format
Parameters:Countries: List of Countries (Default: All Countries)Provinces: List of Provinces and States (Default: All)start_date and end_date: Use these to set the time window you wish to accesscasetype: Python List of Case Types ('confirmed', 'death' and 'recovered' and Default is all)cumsum: gets cummulative sum for each country or provinceplotprovinces: default is false, if True it cumsums over provinces instead of countriesplotCountries(): Plot the country aggregates on world map using Plotly
Parameters:df: Pass a wide dataframe to the function with country-wise aggregates on confirmed, death and recovered casesgrouped_date: Boolean to indicate whether dataset has been aggregated at country level or notmetric: Can be 'confirmed' or 'death' or 'recovered'plot_countries_trend(): Plot the cummultive trends over time for countries. Currently doesn't work for any countries with provinces/states (US, Canada, Australia, France).countries - list of country namesstart_dateend_datecasetype as above,plottype - linear or logfrompycovidimportpycovidpycovid.plot_countries_trend(countries=['Iran','Italy','Spain','Portugal','Japan','Germany','Mexico'],casetype=['confirmed'],start_date="2020-01-01",plottype="linear")plotProvinces(): Plot the values from provinces within a country (tested for australia, US, Canada) over timecountries - just include oneprovinces - optional, include names of any states or provinces, otherwise plots allstart_date and end_date: as abovecasetype: as aboveproportion: default: False, boolean if you want data divided by populationcumulative: default: True, if you want data summed over daysplottype: "log" or "linear"frompycovidimportpycovidpycovid.plot_provinces(contries=['Canada'],provinces=['Alberta','Ontario','Quebec','Manitoba','British Columbia','New Brunswick','Saskatchewan'],casetype=['confirmed'],start_date="2020-02-20",plottype="linear")getIntervalData(): Get resampled dataset of the Coronavirus based on the date (by default Monthly level)df: Pass a wide dataframe to the functioninterval: The time interval you wish to resample the dataset to: 1D = Daily, 1W: Weekly, 1M: MonthlyInstallationpipinstallpycovidfrompycovidimportpycovidpycovid.getCovidCases()or with virtual environment# Configure a virtual environment in project directorypython3-mvenvvenv# Activate the environment (assign paths)sourcevenv/bin/activate# Upgrade Pip and install requirementspipinstall--upgradepippipinstallpycovidRequirementsPandas, Numpy and PlotlyAuthorsPyCOVID was written by Sudharshan Ashoksudharshan93@gmail.comLicenceMIT License