IndEcol / pymrio

Multi-Regional Input-Output Analysis in Python.
http://pymrio.readthedocs.io/en/latest/
Other
158 stars 71 forks source link

World Bank data for Exiobase 2.0 #19

Open bixiou opened 6 years ago

bixiou commented 6 years ago

Data for 2007 from World Bank. Includes data on Population, GDP (in current $ or current PPP), Trade (Ex, Im), Labor, as well as Land area and Energy use.

The (quite arbitrary) order of regions is preserved in the data.

Warning: there is no data for Taiwan (other missing points appear).

Use this code to create a DataFrame from the data:

WB_data = pd.DataFrame(pd.ExcelFile(path_misc+'/WB_data.xls').parse(0)[0:47])
WB_data.set_index('region', inplace=True)
# Euro conversion (WB_data is in dollars but Exiobase is in euros)
USD_EUR = 0.730754
WB_data[['GDP_PPP','GDP','GDPpc','GDPpcPPP','Export','Import']] = USD_EUR*WB_data[['GDP_PPP','GDP','GDPpc','GDPpcPPP','Export','Import']]
# Usage: 
WB_data.loc[['FR','AT']][['GDPpc','GDP']]
coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 32


Totals Coverage Status
Change from base Build 31: 0.0%
Covered Lines: 1010
Relevant Lines: 2354

💛 - Coveralls
coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 34


Totals Coverage Status
Change from base Build 31: 0.0%
Covered Lines: 1010
Relevant Lines: 2354

💛 - Coveralls
bixiou commented 6 years ago

WARNING: there is a problem with RoW Europe (WE) and RoW Asia & Pacific (WA): the World Bank doesn't provide data for Europe, but only for Europe & Central Asia. Similarly, it doesn't provide data for Asia & Pacific, but only for South Asia and for East Asia & Pacific. Hence, I conflated the Exiobase aggregations with the World Bank ones, although they do not coincide. In particular, Central Asia is included in RoW Europe in WB_data.xls, which makes its population four times higher than in population.txt. The effect on RoW Asia is less important (8%), given the much higher population is RoW Asia without Central Asia.

konstantinstadler commented 6 years ago

Hi bixiou, Thanks for the contibution - great that you find pymrio useful. From my side, pymrio is currently on hold since I am on paternity leave until September. I will have a look into the issues and the pull request when I am back. Just a short clearification before you run off in the wrong direction: pymrio aims to be generic for various MRIOs, not only for exiobase2. My plan is to update the population (and also gdp ppp) data when I am back, based on UNdata with some manual work for Taiwan. This will than feed into a dynamic aggregation to be consistent for the different supported mrio databases. best kst

bixiou commented 6 years ago

Ok. Enjoy the family time, Konstantin !

bixiou commented 6 years ago

I cleaned the code I use and put it in oriented-object to push it on my branch of pymrio.

Yet, I am not sure if it should be merged into the main branch of pymrio: yes, some functions are useful (give the impacts, the EROIs or the structural path analysis of some sectors, etc.), but the code is not the neatest. This is so because I integrate several databases and have to include kind of by-hand patches for each of them in the functions. Thus, the code runs well for the databases that are integrated (Exiobase 1 and 2, THEMIS and Cecilia), but probably not for WIOD or Eora. Moreover, THEMIS and Cecilia are kind of unknown database (and the former is not publicly available).

Finally, the code does not pass the tests, and I haven't written a documentation (each function has its doc string but it's not as neat as the main branch of pymrio).

If you think it should be merged, I'll work on passing the tests and documenting it better. I can also push other functions that I have, more related to trade and labor, and implementing choropleth maps.

If you think it shouldn't, I hope you'll be able to merge only my first first commits, which add data from World Bank, and discard the sooner commits of my branch.