World Bank

class pandas_datareader.wb.WorldBankReader(symbols=None, countries=None, start=None, end=None, freq=None, retry_count=3, pause=0.1, session=None, errors='warn')

Download data series from the World Bank’s World Development Indicators

Parameters
  • symbols (WorldBank indicator string or list of strings) – taken from the id field in WDIsearch()

  • countries (string or list of strings.) – all downloads data for all countries 2 or 3 character ISO country codes select individual countries (e.g.``US``,``CA``) or (e.g.``USA``,``CAN``). The codes can be mixed. The two ISO lists of countries, provided by wikipedia, are hardcoded into pandas as of 11/10/2014.

  • start (string, int, date, datetime, Timestamp) – First year of the data series. Month and day are ignored.

  • end (string, int, date, datetime, Timestamp) – Last year of the data series (inclusive). Month and day are ignored.

  • errors (str {'ignore', 'warn', 'raise'}, default 'warn') – Country codes are validated against a hardcoded list. This controls the outcome of that validation, and attempts to also apply to the results from world bank. errors=’raise’, will raise a ValueError on a bad country code.

close()

Close network session

default_start_date

Default start date for reader. Defaults to 5 years before current date

get_countries()

Query information about countries

Notes

Provides information such as:

  • country code

  • region

  • income level

  • capital city

  • latitude

  • and longitude

get_indicators()

Download information about all World Bank data series

params

Parameters to use in API calls

read()

Read data

search(string='gdp.*capi', field='name', case=False)

Search available data series from the world bank

Parameters
  • string (string) – regular expression

  • field (string) – id, name, source, sourceNote, sourceOrganization, topics See notes below

  • case (bool) – case sensitive search?

Notes

The first time this function is run it will download and cache the full list of available series. Depending on the speed of your network connection, this can take time. Subsequent searches will use the cached copy, so they should be much faster.

id : Data series indicator (for use with the indicator argument of WDI()) e.g. NY.GNS.ICTR.GN.ZS” name: Short description of the data series source: Data collection project sourceOrganization: Data collection organization note: sourceNote: topics:

url

API URL

pandas_datareader.wb.download(country=None, indicator=None, start=2003, end=2005, freq=None, errors='warn', **kwargs)

Download data series from the World Bank’s World Development Indicators

Parameters
  • indicator (string or list of strings) – taken from the id field in WDIsearch()

  • country (string or list of strings.) –

    all downloads data for all countries 2 or 3 character ISO country codes select individual countries (e.g.``US``,``CA``) or (e.g.``USA``,``CAN``). The codes can be mixed.

    The two ISO lists of countries, provided by wikipedia, are hardcoded into pandas as of 11/10/2014.

  • start (int) – First year of the data series

  • end (int) – Last year of the data series (inclusive)

  • freq (str) – frequency or periodicity of the data to be retrieved (e.g. ‘M’ for monthly, ‘Q’ for quarterly, and ‘A’ for annual). None defaults to annual.

  • errors (str {'ignore', 'warn', 'raise'}, default 'warn') – Country codes are validated against a hardcoded list. This controls the outcome of that validation, and attempts to also apply to the results from world bank. errors=’raise’, will raise a ValueError on a bad country code.

  • kwargs – keywords passed to WorldBankReader

Returns

data – DataFrame with columns country, year, indicator value

Return type

DataFrame

pandas_datareader.wb.get_countries(**kwargs)

Query information about countries

Provides information such as:

country code, region, income level, capital city, latitude, and longitude

Parameters

kwargs – keywords passed to WorldBankReader

pandas_datareader.wb.get_indicators(**kwargs)

Download information about all World Bank data series

Parameters

kwargs – keywords passed to WorldBankReader

pandas_datareader.wb.search(string='gdp.*capi', field='name', case=False, **kwargs)

Search available data series from the world bank

Parameters
  • string (string) – regular expression

  • field (string) – id, name, source, sourceNote, sourceOrganization, topics. See notes

  • case (bool) – case sensitive search?

  • kwargs – keywords passed to WorldBankReader

Notes

The first time this function is run it will download and cache the full list of available series. Depending on the speed of your network connection, this can take time. Subsequent searches will use the cached copy, so they should be much faster.

id : Data series indicator (for use with the indicator argument of WDI()) e.g. NY.GNS.ICTR.GN.ZS”

  • name: Short description of the data series

  • source: Data collection project

  • sourceOrganization: Data collection organization

  • note:

  • sourceNote:

  • topics: