A package to access imf data
Project description
imf-reader
A package to access IMF data. This package only supports access to the World Economic Outlook (WEO) database. Support for other IMF data and databases may be added in the future.
WEO data is accessed through SDMX (Statistical Data and Metadata eXchange) files published by the IMF. For more information on SDMX, please visit the SDMX.org.
NOTE:
This package is designed to scrape data from the IMF website. The IMF does not provide an official API for accessing WEO data yet. As a result, the tools in this package are subject to breakage if the IMF changes the structure of their website, or releases corrupted data files or unexpected data formats. Please report any issues you encounter.
Installation
$ pip install imf-reader
Usage
Tools to access WEO data can be found in the weo
module.
Import the weo
module and call the fetch_data
function to retrieve the latest WEO data.
from imf_reader import weo
df = weo.fetch_data()
print(df)
By default, the function will return the WEO data for the latest year available. You can specify a version by passing the month and year of the version you want to retrieve. NOTE: The WEO reports are released in April and October of each year. The month of the version must be either "April" or "October".
df = weo.fetch_data(version=("April", 2020))
If the version of the data fetched is needed, it can be
retrieved from the function attribute last_version_fetched
.
df = weo.fetch_data()
print(weo.fetch_data.last_version_fetched)
# >>> ('April', 2024) or whichever version was just fetched
Caching is used to avoid multiple requests to the IMF website for the same data and to enhance performance.
Caching using the LRU (Least Recently Used) algorithm approach and stores data in RAM. The cache is cleared when the program is terminated.
To clear the cache manually, use the clear_cache
function.
weo.clear_cache()
For more advanced usage and tools for WEO data please use the weo-reader package.
Contributing
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
License
imf-reader
was initially created by Luca Picci and is maintained by the ONE Campaign. It is licensed under the terms of the MIT license.
Credits
imf-reader
was created with cookiecutter
and the py-pkgs-cookiecutter
template.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file imf_reader-1.1.0.tar.gz
.
File metadata
- Download URL: imf_reader-1.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e22737d4457dd7168eaf49ffb2afd1db390e012d3488c257f94d20f9ce179600 |
|
MD5 | 8588737076bda2651d01c3c0b37faf74 |
|
BLAKE2b-256 | 1df9bb6b1fb9c15aeaf06be314b5bfe27a02d05cb9d77667d7ae6619aaf7cd21 |
File details
Details for the file imf_reader-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: imf_reader-1.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36f34397803d0da1e56473e9258dcc9d8747ba9be6400561a259983bbef93cc5 |
|
MD5 | 6a5fc936e1d4785b03f7b1a25d919506 |
|
BLAKE2b-256 | 949a802d99f9c9ef340e66a07d694a22870aa39742bda17359bd5335bbe3e342 |