Hi,
tons of thanks for your hard work in the DBnomics project. I write you because I am looping over many providers and downloading their datasets by fetching the metadata with the WebAPI (thanks Christophe!) and downloading with the dbnomics python package likes this:
import pandas as pd
from dbnomics import fetch_series
df = fetch_series(provider_code = provider_code,
dataset_code = dataset_code,
max_nb_series = nb +1) # ← please, notice the +1
This snippet worked fine with all the providers and datasets I tried only IF I ADD +1 TO nb. Without the +1 the data just do not load, so I added the +1.
However when trying to download this dataset: BDF/CPP | DBnomics I got a:
KeyERROR: ‘ADJUSTMENT’
The complete output is:
Traceback (most recent call last):
File “DBnomics_WebAPI.py”, line 114, in
max_nb_series = nb +1) # for some datasets the data does not load without this +1
File “/home/mmoreno/.local/lib/python3.6/site-packages/dbnomics/init.py”, line 162, in fetch_series
editor_api_base_url=editor_api_base_url,
File “/home/mmoreno/.local/lib/python3.6/site-packages/dbnomics/init.py”, line 293, in fetch_series_by_api_link
flat_series[dimension_label] = dict(dataset_dimensions[“dimensions_values_labels”][dimension_code])[
KeyError: ‘ADJUSTMENT’
For this particular BDF/CPP dataset it does not work even if I remove that 1 to nb. I think the issue is that the dataset is very small and consists on 2 timeseries but one is annual and another quaterly so if I downloaded manually they appear in 2 different .csv files and not just 1 .csv with both timeseries.
Does someone know how I can fix this issue so I can automate the download without having to pay attention to small datasets that split into 2 .csv files if downloaded manually?
Tons of thanks,
MMDC