Skip to main content

PyCOCAP: The Python interface to the COCAP database

Project description



pyCOCAP is the Python interface to the common COCAP database. You can find the documentation here


Using the Package Installer for Python PIP, you can install this interface with following command

pip install pycocap


Once the package is installed it is as easy as this to get the COCAP data for example the reported case numbers for Sweden and the stringency index for the UK.

import pycocap as pyc
cases = pyc.cases('Sweden')
npi = pyc.npi('United Kingdom', 'stringency')

If you want to get multiple NPIs into one DataFrame, you can do following

npis = pyc.npis('Germany', ['school closing', 'dept relief', 'facial coverings'])

Defining the start and end dates of the timeseries can be done with Python's standard date objects

from datetime import date
deaths = pyc.death('Canada', start_date=date(2020, 5, 16), end_date=date(2021, 1, 15))

You can also use this to expand the timeseries and at the same time choose with which value to fill gaps

deaths = pyc.death('Canada', start_date=date(2019, 11, 1), fill_value=0)


You can find the documentation here



You can get in touch with me via e-mail or have a look at the source code and open issues there.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycocap-1.2.0.tar.gz (2.1 MB view hashes)

Uploaded Source

Built Distribution

pycocap-1.2.0-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page