Skip to main content

Unofficial library for interacting with the OECD Data Explorer through Python.

Project description

notoecd

⚠️ Unofficial package, not endorsed by the OECD.

A lightweight Python interface for exploring OECD SDMX structures and downloading OECD datasets.

The package provides utilities for:

  • Discovering dataset metadata
  • Searching for relevant datasets using keyword matching
  • Exploring the structure and code lists of a dataset
  • Fetching filtered SDMX data directly into a pandas DataFrame

Installation

You can install the package by running:

pip install notoecd

Quick Start

import notoecd

The main functions in this module are:

search_keywords(keywords) -> pd.DataFrame
get_structure(agencyID, dataflowID) -> Structure
get_df(agencyID, dataflowID, filters) -> pd.DataFrame

Searching for datasets

search_keywords performs:

  • Normalized text matching
  • Accent-insensitive search
  • Multi-keyword OR matching
  • Ranking by number of matched keywords

Example:

hits = notoecd.search_keywords(['gross domestic product', 'tl2', 'tl3'])

This returns datasets that mention GDP and regional levels (TL2/TL3). It gives their name, description, and identifiers (agencyID and dataflowID), which we will need for the next step.


Inspecting dataset structure

Once a dataset is identified, load its SDMX structure:

dataset = 'Gross domestic product - Regions'
agencyID = 'OECD.CFE.EDS'
dataflowID = 'DSD_REG_ECO@DF_GDP'

s = notoecd.get_structure(agencyID, dataflowID)

Table of contents

s.toc

This shows all filters and their available values.

Exploring code values

s.explain_vals('MEASURE')
s.explain_vals('UNIT_MEASURE')

This shows the available measures and units used in the dataset.


Filtering and downloading data

To download data, build a dictionary of filters.
Keys correspond to SDMX dimensions, values are strings or lists (for multiple values):

filters = {
    'territorial_level': ['tl2', 'tl3'],
    'measure': 'gdp',
    'prices': 'Q',
    'unit_measure': 'USD_PPP_PS'
}

Fetch the filtered dataset:

df = notoecd.get_df(agency, dataflow, filters)
df.head()

The returned object is a pandas DataFrame containing the requested subset of OECD SDMX data.


Examples

You can see this full example as a notebook called example.ipynb.

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

notoecd-0.1.3.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

notoecd-0.1.3-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file notoecd-0.1.3.tar.gz.

File metadata

  • Download URL: notoecd-0.1.3.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for notoecd-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5db28f68790f412858e672e02de49b012a4028509eeb14ad322ffa77e5027de5
MD5 c24d54c790effe2289fe3d0e2632969d
BLAKE2b-256 ac3b9e8701a992e81541d7b12ff2695ee405867243f122a91a9900e7273afd9d

See more details on using hashes here.

File details

Details for the file notoecd-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: notoecd-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for notoecd-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f24022aaa2810b3590d7acded09b3d3e351f43585b7ef2b6c0296c81f88d62d2
MD5 c91c031448c4a26c6f2e23e9d92576c1
BLAKE2b-256 110bbc7ae0016c6f8173c8b5c89f6a0c88b6b4016b30d4f27b5760133f26da5f

See more details on using hashes here.

Supported by

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