Syndicate content

opendata dataviz python R ruby stata API

Accessing the World Bank Data APIs in Python, R, Ruby & Stata

Tariq Khokhar's picture



Developers, analysts and researchers often use our data through the APIs we provide. We’ve written about accessing World Bank data in Stata in the past, but I’m going to take a moment to survey the other language-specific libraries that I know of. From now on, unless I state otherwise, by “API”, I’m referring to our development indicators API.

I’ll list the libraries first, and then show some examples with a couple of them:

  • Python: The wbdata module by Oliver Sherouse offers easy access to all the data in our APIs. It also plays nicely with Wes McKinney’s superb ‘pandas’ analysis library. I’m less familiar with Matthew Duck’s wbpy module but it appears to offer similar functionality and also provides access to the Climate Data API.

    Edit: Vincent notes in the comments below that he's ported his R package to Python and it is now integrated directly in the Pandas library as an I/O module

  • R: The WDI module by Vincent Arel-Bundock offers convenient access to the data in our API and opens the door to using it with the awesome ggplot2 graphing library. You can also access the Climate Data API in R with rWBclimate.

  • Ruby: The world_bank_ruby gem by Justin Stoller has some nice features for bringing our data into Ruby.

  • Stata: The wbopendata module byJoão Pedro Azevedo offers access to all our data, and the worldstat modules by Damian C. Clarke builds on it to add charting and mapping features.