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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imf_reader-2.2.0.tar.gz.
File metadata
- Download URL: imf_reader-2.2.0.tar.gz
- Upload date:
- Size: 51.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f725d5759b0d78875833ee9a5c66cd27d61c31bd8a553ff71eee05b5e628b57
|
|
| MD5 |
06c985eab8f17bab698ebac597478153
|
|
| BLAKE2b-256 |
da26f6ed424490fb49798c86eb5990448a4bba1ad7d5821c34857b9053e46ed5
|
Provenance
The following attestation bundles were made for imf_reader-2.2.0.tar.gz:
Publisher:
release.yml on ONEcampaign/imf-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imf_reader-2.2.0.tar.gz -
Subject digest:
3f725d5759b0d78875833ee9a5c66cd27d61c31bd8a553ff71eee05b5e628b57 - Sigstore transparency entry: 2467987310
- Sigstore integration time:
-
Permalink:
ONEcampaign/imf-reader@43d56345a9c028585de859a072322fe59972522d -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/ONEcampaign
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@43d56345a9c028585de859a072322fe59972522d -
Trigger Event:
release
-
Statement type:
File details
Details for the file imf_reader-2.2.0-py3-none-any.whl.
File metadata
- Download URL: imf_reader-2.2.0-py3-none-any.whl
- Upload date:
- Size: 59.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7decf529540b0d923e5fc39e5afaf899ce46d7e199b7163d1ad346bde954a4a
|
|
| MD5 |
6a98c11c523e77eb544d418aafba59d1
|
|
| BLAKE2b-256 |
7c0bf039227891003395030935c2efeba61f72048fd6cbc7c38f678024964f68
|
Provenance
The following attestation bundles were made for imf_reader-2.2.0-py3-none-any.whl:
Publisher:
release.yml on ONEcampaign/imf-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imf_reader-2.2.0-py3-none-any.whl -
Subject digest:
b7decf529540b0d923e5fc39e5afaf899ce46d7e199b7163d1ad346bde954a4a - Sigstore transparency entry: 2467987638
- Sigstore integration time:
-
Permalink:
ONEcampaign/imf-reader@43d56345a9c028585de859a072322fe59972522d -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/ONEcampaign
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@43d56345a9c028585de859a072322fe59972522d -
Trigger Event:
release
-
Statement type: