Starting from previous Google Colab notebook
The following steps will serve as a guideline to mirror the statistics of one selected pair from five selected countries:
Load the notebook with commands developed in step 2.3. (click on the link):
https://colab.research.google.com/drive/1S24nLFMr_yeo4VmXlpq8WKM7qcNLL1ZI?usp=sharing
Reload and remember the list with the pairwise combination of names of the five selected countries:
print(list_pairwise_comb)
first_pair = list_pairwise_comb[0]
print(first_pair[0])
print(first_pair[1])
[('Afghanistan', 'Albania'),
('Afghanistan', 'Algeria'),
('Afghanistan', 'American Samoa'),
('Afghanistan', 'Andorra'),
('Albania', 'Algeria'),
('Albania', 'American Samoa'),
('Albania', 'Andorra'),
('Algeria', 'American Samoa'),
('Algeria', 'Andorra'),
('American Samoa', 'Andorra')]
Afghanistan
Albania
3. Reload the five countries' names and select the first and second countries to find their iso3codes:
df_countries[df_countries['name'] == list_names[0]]
df_countries[df_countries['name'] == list_names[1]]
4. Obtaining the values of Afghanistan (iso3code = 'afg') importation from Albania (iso3code='alb') and its total:
afg_imports_2010 = wits.get_indicator('MPRT-TRD-VL', partner='alb', reporter='afg', year='2010')
total_afg_from_alb = afg_imports_2010['Value'].sum()
162.541
5. Obtaining the values of Albania (iso3code='alb') exportation to Afghanistan (iso3code = 'afg') and its total:
alb_exports_2010 = wits.get_indicator('XPRT-TRD-VL', partner='afg', reporter='alb', year='2010')
total_alb_to_afg = alb_exports_2010['Value'].sum()
9.15
6. Compute the percentage of the difference between the two previous measures:
difference = total_afg_from_alb - total_alb_to_afg
perc_difference = (difference/total_alb_to_afg)*100
1676.4043715846992
7. The Python code with all the steps is summarized in this Google Colab:
https://colab.research.google.com/drive/1dH3KLInDwMWLrnj9ecobpRxvBMUii6QG?usp=sharing