Python package for downloading economic data from the International Monetary Fund SDMX 3.0 API, following econdataverse conventions.
Actively maintained. Last release 6 weeks ago, commits in 7 of the last 26 weeks. A safe choice.
pip install imfpimfp
imfp, by Christopher C. Smith, is a Python package for downloading data from the International Monetary Fund's RESTful JSON API.
Installation
pip install -q --upgrade imfp
Quick Start
imfp follows the econdataverse conventions, mirroring the R package imfapi. Fetching data takes four steps, one per function:
import imfp
# 1. Find a dataset
dataflows = imfp.imf_get_dataflows()
# 2. See how it can be filtered
dimensions = imfp.imf_get_datastructure("PCPS")
# 3. Find valid codes for those dimensions
codes = imfp.imf_get_codelists(["INDICATOR", "FREQUENCY"], "PCPS")
# 4. Fetch the data
df = imfp.imf_get(
"PCPS",
dimensions={
"INDICATOR": ["PCOAL"],
"DATA_TRANSFORMATION": ["INDEX"],
"FREQUENCY": ["A"],
},
)
Dimensions can also be passed as keyword arguments:
df = imfp.imf_get("PCPS", indicator="PCOAL", data_transformation="INDEX", frequency="A")
Upgrading from 1.x
Version 2.0.0 replaces the old four-function API. The old names still work but emit a DeprecationWarning, and will be removed in 3.0.0.
| imfp 1.x | imfp 2.0 |
|---|---|
imf_databases() | imf_get_dataflows() |
imf_parameters(db) | imf_get_codelists(dims, db) |
imf_parameter_defs(db) |