The purpose of this blog post is to perform a data analysis of the COVID-19 outbreak, arrive at some charts and perform some forecasting for the near future.
Install Python and Jupyter Notebook to Windows 10 (64 bit)
- Download Python 3.7.4 or latest from “https://www.python.org/downloads/release/python-374/” url
- Choose and select “x86–64 executable installer” for Windows 10–64 bit computer and install
- Check the installation by running “Idle”
- Set “Python37” path and “Python37/Scripts” path to environment variable
- Open command prompt and check the python version using “python –version”
- Install pip using “pip install virtualenv”
- Upgrade pip using “python -m pip install -upgrade pip”
- Create a virtual environment called opencv (“virtualenv opencv”)
- Move to Scripts folder and activate opencv virtual environment using “activate.bat”
- Install numpy using “pip install numpy”
- Install OpenCV using “pip install opencv-python”
- Install Matplotlib using “pip install matplotlib”
- Install Jupyter using “python -m pip install jupyter”
- Run Jupyter Notebook using “jupyter notebook”
- Start the notebook server and popup dashboard in browser using “localhost:8888/tree” url
- Create your first notebook using dashboard by clicking on new Python 3
17. Type print (“Hello World”) in the cell and click Run to view the output or Type 3 + 5 in the cell and view output.
Plot a graph of existing data
- Install conda using miniconda https://docs.conda.io/projects/conda/en/latest/user-guide/install/. Advisable to reboot the laptop post installation.
- Open conda powershell prompt
conda env create -f environment.yaml
- (base) PS C:\MainFolder\CondaInstalledFolder> conda activate COVID19
- (COVID19) PS C:\MainFolder\CondaInstalledFolder> cd D:\covid-19\covid-19-notebooks\notebooks
(COVID19) PS D:\covid-19\covid-19-notebooks\notebooks> jupyter notebook
- Ensure that the attached csv (data) file and the notebook file are present in the folder. Have modified the code to update the graph. You can customize it the way you like.
- The output can be viewed like in the attached screen below.
Reference : https://github.com/alexamici/covid-19-notebooks
Plot a graph for forecasted data
- Download the corona virus dataset from https://www.kaggle.com/chriscc/coronavirus-confirmed-prediction-with-prophet
- Create a new environment with Python3.5
- conda create -n pht python=3.5 anaconda
- Install Prophet using the command.
- conda install -c conda-forge fbprophet
- (base) PS C:\MainFolder\CondaInstalledFolder> conda activate pht
- (pht) PS C:\MainFolder\CondaInstalledFolder> cd D:\covid-19\covid-19-notebooks\notebooks
- (pht) PS D:\covid-19\covid-19-notebooks\notebooks> jupyter notebook
- Run the cells in the attached notebook along with the attached data.
8. The output can be viewed like in the attached screen below. It is prediction of cases over the next 1 month.
(The specific graph below is the prediction of number of cases for Canada till May-09-2020.)
$ jupyter nbconvert --to html mynotebook.ipynb
to convert the notebook to html or pdf.
xelatex will need to be installed for converting to pdf.
It goes without saying that
Your analytics and Insights are only as good as the data that feeds them !!