Skip to content

Latest commit

 

History

History
160 lines (115 loc) · 2.4 KB

demo.md

File metadata and controls

160 lines (115 loc) · 2.4 KB

All Countries

%load_ext autoreload
%autoreload 2
import world_bank_data.wits as wits
wits.get_countries()
wits.get_countries(datasource='tradestats-tariff')
wits.get_countries(datasource='tradestats-trade')
wits.get_countries(datasource='tradestats-trade').loc['AUS']

Nomenclature

wits.get_nomenclatures()
wits.get_nomenclatures(datasource='tradestats-tariff')
wits.get_nomenclatures(datasource='tradestats-trade')

Products

wits.get_products()
wits.get_products(datasource='tradestats-tariff')
wits.get_products(datasource='tradestats-trade')

Indicators

wits.get_indicators(datasource='tradestats-tariff')
wits.get_indicators(datasource='tradestats-trade')
idx = wits.get_indicators(datasource='tradestats-trade')
idx.loc[idx['name'].apply(lambda s: 'US$' in s)]
idx.loc[idx['name'].apply(lambda s: 'US$' in s)].definition.to_dict()

Data availability

df = wits.get_dataavailability()
df
df.loc[('EUN', '2017')]
df = wits.get_dataavailability(datasource='tradestats-tariff')
df
df.loc[('AUS', '2017')]
df = wits.get_dataavailability(datasource='tradestats-trade')
df
df.loc[('FRA', '2017')]

Tariff Data

Reported

df = wits.get_tariff_reported(reporter='840', partner='all', product='010129')
df

Estimated

df = wits.get_tariff_estimated(reporter='840', partner='000', product='010130')
df

Get Indicator

df = wits.get_indicator(reporter='usa', 
                        year='2017', 
                        partner='all',
                        product='all',
                        indicator='MPRT-TRD-VL', 
                        datasource='tradestats-trade')
df
df.groupby('Partner').Value.sum().sort_values(ascending=False)
df.groupby('ProductCode').Value.sum().sort_values(ascending=False)
prd = wits.get_products(datasource='tradestats-trade')
prd

SDMX

http://wits.worldbank.org/API/V1/SDMX/V21/rest/dataflow/wbg_wits/

http://wits.worldbank.org/API/V1/SDMX/V21/rest/codelist/all/

http://wits.worldbank.org/API/V1/SDMX/V21/rest/datastructure/WBG_WITS/TARIFF_TRAINS/