Basic functionality
The basic functionality for wbdata users is provided by a set of functions in
the topic level package namespace.
Data Retrieval
These are the functions for actually getting data values from the World Bank API.
Raw Data Retrieval
get_data(indicator, country='all', date=None, freq='Y', source=None, parse_dates=False, skip_cache=False)
Retrieve indicators for given countries and years
| Parameters: |
|
|---|
| Returns: |
|
|---|
Pandas Data Retrieval
These functions require Pandas to be installed to work.
get_series(indicator, country='all', date=None, freq='Y', source=None, parse_dates=False, name='value', keep_levels=False, skip_cache=False)
Retrieve data for a single indicator as a pandas Series.
If pandas is not installed, a RuntimeError will be raised.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_dataframe(indicators, country='all', date=None, freq='Y', source=None, parse_dates=False, keep_levels=False, skip_cache=False)
Download a set of indicators and merge them into a pandas DataFrame.
If pandas is not installed, a RuntimeError will be raised.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Metadata Retrieval
These functions, for the most part, are for finding the parameters you want to put into the data retrieval functions. These all return SearchResult, which are lists that pretty-print the table in an interactive environment, and which contain dictionary representations of the requested resource.
Searchable Metadata
There are enough indicators and countries that it's annoying to look through
them, so the functions for retrieving information about them can be narrowed
with additional facets and filtered with a search term or regular expression
supplied to the query parameter.
get_countries(country_id=None, query=None, incomelevel=None, lendingtype=None, skip_cache=False)
Retrieve information on one or more country or regional aggregates.
You can filter your results by specifying query,incomelevel, orlendingtype. Specifyingquery` will only return countries with
names that match the query as a regular expression. If a string is
supplied, the match is case insensitive.
Specifying query, incomelevel, or lendingtype along with
country_id will raise a ValueError.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_indicators(indicator=None, query=None, source=None, topic=None, skip_cache=False)
Retrieve information about an indicator or indicators.
When called with no arguments, returns all indicators. You can specify
one or more indicators to retrieve, or you can specify a source or a
topic for which to list all indicators. Specifying more than one of
indicators, source, and topic will raise a ValueError.
Specifying query will only return indicators with names that match
the query as a regular expression. If a string is supplied, the match
is case insensitive. Specifying both query and indicators will raise
a ValueError.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Indicator Facets
get_sources(source_id=None, skip_cache=False)
Retrieve information on one or more sources
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_topics(topic_id=None, skip_cache=False)
Retrieve information on one or more topics
| Parameters: |
|
|---|
| Returns: |
|
|---|
Country Facets
get_incomelevels(level_id=None, skip_cache=False)
Retrieve information on one or more income level aggregates
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_lendingtypes(type_id=None, skip_cache=False)
Retrieve information on one or more lending type aggregates
| Parameters: |
|
|---|
| Returns: |
|
|---|