Python client to read IMF WEO dataset as pandas dataframe
Project description
weo-reader
- The program uses Python 3.6. To install
weoas a python package use:
pip install weo
- You need the data saved as a local file. Download latest WEO country data file from IMF web site (for example as
weo.csv).
You can do it manually in a command line with curl command:
curl -o weo.csv https://www.imf.org/external/pubs/ft/weo/2019/02/weodata/WEOOct2019all.xls
Please note WEOOct2019all.xls is in fact a tab-delimited CSV file.
Alternatively, can use weo.download() function:
from weo import download
download('weo.csv', 2019, 2)
-
Use
WEOclass fromweopackage orweo.pyto view and extract data.WEOis a wrapper around a by-country pandas dataframe that ensures proper data import and easier access to it. -
Things to try in a REPL, by line:
from weo import WEO
w = WEO('weo.csv')
# What is inside?
w.variables()
w.units()
w.units('Gross domestic product, current prices')
w.codes()
w.code('LUR')
# Countries
w.find_countries('United')
w.iso_code('Netherlands')
# Get some data
w.get('General government gross debt', 'Percent of GDP')
w.gdp_usd(2024).head(20).sort_values().plot.barh(title="GDP by country, USD bln (2024)")
w.country('DEU', 2018)
Dev notes
WEOOct2019all.xlsfile from the web site is really a CSV file.
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
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 weo-0.0.8.tar.gz.
File metadata
- Download URL: weo-0.0.8.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cae0ebf64e1d028e31696d74663fc00548c233a2b86ffc36a4eb68fa6af396fe
|
|
| MD5 |
5ce5a466e27606b320d21d5fb0c2e0a3
|
|
| BLAKE2b-256 |
83bfc5c0049f5c313cc184ad85879863303b7bd388417a27dc6ba91ddd8c8c33
|
File details
Details for the file weo-0.0.8-py3-none-any.whl.
File metadata
- Download URL: weo-0.0.8-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
327df2b90093c192f5c8731841e453b7131391b120116a84b7d150168607146d
|
|
| MD5 |
e89a137e21d9fedf8de61423a8a95442
|
|
| BLAKE2b-256 |
c0e41f6bf8a10effb14235a2caf03848af5ba05b9c41213a0c04a99ee2a08990
|