Open In Colab

View in Jupyter nbviewwer

logo-bitmap-small.png

Simple demonstration notebook of PyCoA framework

ⓒpycoa.fr

This notebook is designed for the v2.0 (or later) version of pycoa.

Getting PyCoA installed

If you're under Google Colab, or if pycoa in not installed, you have to run the pip install command bellow. You may experience version errors about datasience, coveralls and pytest, but this should be ok.

In [1]:
!pip install --quiet git+https://github.com/coa-project/pycoa.git # getting the latest official production version
# !pip install --quiet --user git+https://github.com/coa-project/pycoa.git   # One may need to add the --user option at the "pip install" command, if it fails due to privilege lack. Under google colab, you must not add this option.
     |████████████████████████████████| 163kB 6.1MB/s 
     |████████████████████████████████| 61kB 4.2MB/s 
     |████████████████████████████████| 102kB 5.3MB/s 
     |████████████████████████████████| 1.0MB 8.9MB/s 
     |████████████████████████████████| 10.1MB 16.1MB/s 
     |████████████████████████████████| 286kB 47.6MB/s 
     |████████████████████████████████| 245kB 52.4MB/s 
     |████████████████████████████████| 14.8MB 321kB/s 
     |████████████████████████████████| 6.5MB 39.2MB/s 
     |████████████████████████████████| 245kB 52.7MB/s 
  Building wheel for PyCoA (setup.py) ... done
  Building wheel for datascroller (setup.py) ... done
  Building wheel for pycountry (setup.py) ... done
  Building wheel for pandasql (setup.py) ... done
ERROR: datascience 0.10.6 has requirement coverage==3.7.1, but you'll have coverage 5.5 which is incompatible.
ERROR: datascience 0.10.6 has requirement folium==0.2.1, but you'll have folium 0.12.1 which is incompatible.
ERROR: coveralls 0.5 has requirement coverage<3.999,>=3.6, but you'll have coverage 5.5 which is incompatible.

If pycoa is already installed on your system but is not in your path, you should specfiy it with the next lines (with the correct path); then please uncomment the second line.

In [2]:
import sys    # adapt the path for local install, if necessary. Under google colab, do not change anything
# sys.path.insert(1, '../pycoa')   

Importing the front module

In [3]:
import coa.front as cf
# default database for front is JHU
JHU aka Johns Hopkins database selected ...
Few information concernant the selected database :  jhu
Available which key-words for:  ['deaths', 'confirmed', 'recovered']
Example of location :  Japan, Togo, Denmark, Malta, Costa Rica  ...
Last date data  2021-03-10
In [4]:
cf.getversion() # should be >= v2.0
Out[4]:
'v2.01'

Using the front module to produce simple plot, map, histo

In [5]:
cf.plot(option='sumall') # default is which='deaths', what='cumul', and for all countries
In [6]:
cf.plot(where='g20') # managing region