Open In Colab

View in Jupyter nbviewwer


Simple demonstration notebook of PyCoA framework


This notebook is designed for the v2.0 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 [ ]:
!pip install --quiet git+[email protected]
# !pip install --quiet --user git+[email protected]   # 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 9.0MB/s 
     |████████████████████████████████| 61kB 5.7MB/s 
     |████████████████████████████████| 102kB 4.8MB/s 
     |████████████████████████████████| 972kB 8.3MB/s 
     |████████████████████████████████| 10.1MB 31.3MB/s 
     |████████████████████████████████| 286kB 49.3MB/s 
     |████████████████████████████████| 245kB 56.0MB/s 
     |████████████████████████████████| 14.8MB 261kB/s 
     |████████████████████████████████| 6.5MB 40.1MB/s 
     |████████████████████████████████| 245kB 58.1MB/s 
  Building wheel for PyCoA ( ... done
  Building wheel for datascroller ( ... done
  Building wheel for pycountry ( ... done
  Building wheel for pandasql ( ... done
ERROR: datascience 0.10.6 has requirement coverage==3.7.1, but you'll have coverage 5.4 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.4 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 [ ]:
import sys    # adapt the path for local install, if necessary. Under google colab, do not change anything
# sys.path.insert(1, '../pycoa')   
In [ ]:
# testing the correct install of pycoa
import importlib
coa_module_info = importlib.util.find_spec("coa")
if coa_module_info == None:
  raise ModuleNotFoundError("The coa module is not found. Please check your install")

import coa
if coa.__version__ != 'v2.0':
  raise ImportError("The pycoa package version is incorrect. Expecting v2.0")

Importing the front module

In [ ]:
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 :  Cambodia, , Dominica, Thailand, Syrian Arab Republic  ...
Last date data  2021-02-18

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

In [ ]:
cf.plot(option='sumall') # default is which='deaths', what='cumul', and for all countries
In [ ]:
cf.plot(where='g20') # managing region
In [ ]:'oecd',what='daily',when='01/02/2021',which='confirmed')