Skip to main content

Python client to read IMF WEO dataset as pandas dataframe

Project description


  1. The program uses Python 3.6. To install weo as a python package use:

pip install weo

  1. 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

Please note WEOOct2019all.xls is in fact a tab-delimited CSV file.

Alternatively, can use function:

from weo import download

download('weo.csv', 2019, 2)
  1. Use WEO class from weo package or to view and extract data. WEO is a wrapper around a by-country pandas dataframe that ensures proper data import and easier access to it.

  2. Things to try in a REPL, by line:

from weo import WEO

w = WEO('weo.csv') 

# What is inside?



w.units('Gross domestic product, current prices')


# Countries



# 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)")'DEU', 2018)
  1. Try Google Colab Notebook

Dev notes

  • WEOOct2019all.xls file from the web site is really a CSV file.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for weo, version 0.0.65
Filename, size File type Python version Upload date Hashes
Filename, size weo-0.0.65-py3-none-any.whl (9.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size weo-0.0.65.tar.gz (5.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page