Useful tool to access Rami Krispin Novel Corona Dataset
Project description
PyCOVID Package
The 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) Coronavirus
Try in a collaboratory iPython notebook
Quick Installation
pip install pycovid
Importing
from pycovid import pycovid
pycovid.getCovidCases()
Value Addition
The '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, casetype
- Cumulative Aggregating options - cumsum parameter to look at the cumulative totals of how the Coronavirus has grown over time
- Time Resampling: Converts dataframe to time-indexed, and resamples at required time level (weekly, monthly, etc)
- Quick visualization using Plotly: Use the plotCountries() function
Usage
getCovidCasesWide() : 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 access
- casetype: 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 access
- casetype: Python List of Case Types ('confirmed', 'death' and 'recovered' and Default is all)
- cumsum: gets cummulative sum for each country or province
- plotprovinces: default is false, if True it cumsums over provinces instead of countries
plotCountries(): 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 cases
- grouped_date: Boolean to indicate whether dataset has been aggregated at country level or not
- metric: 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 names
- start_date
- end_date
- casetype as above,
- plottype - linear or log
from pycovid import pycovid
pycovid.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 time
- countries - just include one
- provinces - optional, include names of any states or provinces, otherwise plots all
- start_date and end_date: as above
- casetype: as above
- proportion: default: False, boolean if you want data divided by population
- cumulative: default: True, if you want data summed over days
- plottype: "log" or "linear"
from pycovid import pycovid
pycovid.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 function
- interval: The time interval you wish to resample the dataset to: 1D = Daily, 1W: Weekly, 1M: Monthly
Installation
pip install pycovid
from pycovid import pycovid
pycovid.getCovidCases()
or with virtual environment
# Configure a virtual environment in project directory
python3 -m venv venv
# Activate the environment (assign paths)
source venv/bin/activate
# Upgrade Pip and install requirements
pip install --upgrade pip
pip install pycovid
Requirements
Pandas, Numpy and Plotly
Authors
PyCOVID was written by Sudharshan Ashok sudharshan93@gmail.com
Licence
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pycovid-1.0.0.tar.gz
.
File metadata
- Download URL: pycovid-1.0.0.tar.gz
- Upload date:
- Size: 643.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 838d04bda2ccb530c977d6ca614a93f2e95426e958a9f27d354bc5dc9617714f |
|
MD5 | e9d962c6677801656a9236fb40198abd |
|
BLAKE2b-256 | 377672b0427cf3549e3542e12893c68a6173fb48026a0f6b42919a233183265f |
File details
Details for the file pycovid-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pycovid-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08638ad435eb270ce0ca67fd4fe585039eb06b9f85e247b160d30a507dbb10a4 |
|
MD5 | 72e981880d6afba50031eac554247f78 |
|
BLAKE2b-256 | 257b1e7fe197edebca6a89ca0065e18dbf9e8f7244e0987c900e3a93aa661234 |