Skip to main content

PyPI version PyPI - Python Version Anaconda version Docs

imf-reader

Python access to IMF World Economic Outlook and Special Drawing Rights data.

imf-reader fetches two IMF datasets that are hard to reach programmatically, the World Economic Outlook (WEO) database and Special Drawing Rights (SDR) data, and returns them as tidy pandas DataFrames.

WEO data comes from the IMF's SDMX API for releases from April 2025 onward and from a discontinued bulk SDMX archive for everything before it, translated onto one vocabulary so columns and codes match across both sources. SDR daily valuation and weekly interest rates have no API, so imf-reader parses them from IMF web pages. SDR allocations and holdings do exist on the API at monthly frequency, but this package has not moved to it and still parses them from web pages too. Both sources make the package sensitive to changes in the IMF's site structure or file formats. Please report any issues you encounter.

Installation

pip install imf-reader

Or with uv:

uv add imf-reader

Or from conda-forge:

conda install imf-reader

Usage

Fetch WEO data and filter it, for example Nigeria's real GDP growth:

from imf_reader import weo

df = weo.fetch_data()
growth = df[
    (df.REF_AREA_CODE == "NGA")
    & (df.CONCEPT_CODE == "NGDP_RPCH")
    & (df.TIME_PERIOD.between(2020, 2024))
]
print(growth[["REF_AREA_LABEL", "TIME_PERIOD", "OBS_VALUE", "UNIT_LABEL"]].to_string(index=False))

Output:

REF_AREA_LABEL  TIME_PERIOD  OBS_VALUE UNIT_LABEL
       Nigeria         2020  -6.368898    Percent
       Nigeria         2021   1.109253    Percent
       Nigeria         2022   4.318829    Percent
       Nigeria         2023   3.315904    Percent
       Nigeria         2024   4.071067    Percent

fetch_data() returns observations. The IMF also publishes series-level metadata, one row per series, covering methodology notes, classification codes, and fiscal-year reporting conventions:

meta = weo.fetch_series_metadata()
merged = weo.fetch_data_with_metadata()

fetch_series_metadata() returns that metadata on its own, keyed on REF_AREA_CODE, CONCEPT_CODE, and FREQ_CODE. fetch_data_with_metadata() returns the two merged, resolving both halves to the same release. Series metadata covers April 2025 onward, the releases the IMF API itself carries.

Fetch SDR allocations and holdings:

from imf_reader import sdr

df = sdr.fetch_allocations_holdings()

This returns one row per entity per indicator, with entity, indicator (holdings or allocations), value, and date columns.

Versions, caching, and the full column reference for both datasets are covered in the documentation.

Documentation

Full documentation lives at docs.one.org/tools/imf-reader. Start with Why imf-reader for the motivation, Getting started for a first walkthrough, and the WEO and SDR guides for dataset-specific detail.

Contributing

Contributions are welcome. See CONTRIBUTING.md for guidelines. This project is released with a Code of Conduct. By contributing, you agree to abide by its terms.

License

imf-reader is licensed under the MIT license. It was created by Luca Picci and is maintained by the ONE Campaign.

Metadata

Release files for imf-reader 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imf-reader 2.3.0
File Size Uploaded Provenance Actions
imf_reader-2.3.0.tar.gz 52.5 kB With provenance Details for imf_reader-2.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for imf-reader 2.3.0
File Interpreter ABI Platform Actions
imf_reader-2.3.0-py3-none-any.whl Python 3 none any Details for imf_reader-2.3.0-py3-none-any.whl

Total release size: 112.0 kB

Release files / imf_reader-2.3.0.tar.gz

Download URL imf_reader-2.3.0.tar.gz
Size 52.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9cab989a4fd93f311b97439531f2e67797bd6b401a80182650029aff4c7e6afd
BLAKE2b-256 checksum
How to use checksums
353b67edd08e13c35886a0fcc56f3bd58f904286ec5e7dc5a7f6f05ed7d70c23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / imf_reader-2.3.0-py3-none-any.whl

Download URL imf_reader-2.3.0-py3-none-any.whl
Size 59.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0d56ad284ff79d0f2602384fab1281ca83d7524fcd34bf4441651b33edd19e5
BLAKE2b-256 checksum
How to use checksums
a6116a2908720eeec1d946d010d5631f7dbf4fcf1ee473ae24e7faf1bf2bfef5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for imf-reader 2.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for imf_reader-2.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page