GitHub - ceschi/dbnomics-python-client: Access DBnomics time series from Python. Mirror of https://git.nomics.world/dbnomics/dbnomics-python-client

Access DBnomics time series from Python.

This project relies on Python Pandas.

Tutorial

A tutorial is available as a Jupyter notebook.

The "Binder" tool allows you to run it interactively in your browser. Click on Binder then wait a couple of seconds. After loading a list of files should be displayed. Click on index.ipynb to open the tutorial notebook, where you'll be able to play with the DBnomics Python client.

Install

See also: https://pypi.org/project/DBnomics/

Development

To work on dbnomics-python-client source code:

git clone https://git.nomics.world/dbnomics/dbnomics-python-client.git
cd dbnomics-python-client
pip install --editable .

If you plan to use a local Web API, running on the port 5000, you'll need to use the api_base_url parameter of the fetch_* functions, like this:

dataframe = fetch_series(
    api_base_url='http://localhost:5000',
    provider_code='AMECO',
    dataset_code='ZUTN',
)

Or set the default API URL by monkey-patching the dbnomics module, like this:

import dbnomics
dbnomics.default_api_base_url = "http://localhost:5000"

Tests

Run tests:

pytest tests/test_client.py

# Specify an alterate API URL
API_URL=http://localhost:5000 pytest tests/test_client.py