Introducing EconData’s Python package

We are pleased to announce the launch of EconData’s Python Package! While the package is still experimental and limited in its feature set, it is ready to be used for downloading time series data from EconData.

To use the package, install 

pip install -i https://test.pypi.org/simple/ econdatapy

and then (using your EconData login details) run with

ECONDATA_CREDENTIALS="username;password" python

To download data from EconData you must import the read module

from econdatapy import read

x = read.dataset(id, 
                 agencyid = agencyid, 
                 version = version, 
                 release = release,
                 series_key = series_key,
                 release = release)

The only required parameter is the data set id (see available data), the named arguments are optional: agencyid defaults to “ECONDATA”, version defaults to “latest”, series_key defaults to all series, release defaults to the current date and time – you can specify the release as a date and time “yyyy-dd-mmTHH:MM:SS” or you can use the release description (as found on the EconData app). There are also optional arguments for username and password, but it is preferred to have your credentials saved as an environment variable.

The data once read from EconData is returned as a Python dictionary with two fields metadata and data. The metadata field contains the details of the data set metadata, and the data field contains a named field (time series key) for each time series which itself is represented by a pandas DataFrame. Each DataFrame also has a metadata attribute that details the metadata of the time series.

>>> from econdatapy import read

>>> x = read.dataset("MINING")
Fetching dataset(s) - MINING

Processing data set: ECONDATA-MINING-1.1.0

>>> x["metadata"]
{'agencyid': 'ECONDATA', 'id': 'MINING', 'version': '1.1.0', 'name': ['en', 'Mining'], 'provision-agreement': ['#sdmx.infomodel.registry.ProvisionAgreeme
ntRef', {'agencyid': 'ECONDATA', 'id': 'MINING_ECONDATA_STATSSA', 'version': '1.1.0'}], 'SOURCE_DATASET': 'P2041'}

>>> y = x["data"]

>>> y["MIN001.I.N"]
    TIME_PERIOD  OBS_VALUE
0    1980-01-01      105.2
1    1980-02-01      105.6
2    1980-03-01      105.1
3    1980-04-01      105.8
4    1980-05-01      108.7
..          ...        ...
525  2023-10-01       96.0
526  2023-11-01       99.9
527  2023-12-01       88.5
528  2024-01-01       80.7
529  2024-02-01       82.9

[530 rows x 2 columns]

>>> y["MIN001.I.N"].metadata
{'MNEMONIC': 'MIN001', 'FREQ': 'M', 'BASE_PER': '2019', 'series-key': 'MIN001.I.N', 'MEASURE': 'I', 'SEASONAL_ADJUST': 'N', 'UNIT_MEASURE': 'Index', 'SOU
RCE_IDENTIFIER': 'FMP20000', 'LABEL': 'Total, gold included'}

>>> z = y["MIN001.I.N"].plot(title="Mining production: Total, gold included", ylabel="Index")