Handling the WIOD EE MRIO database

Getting the database

The WIOD database is available at http://www.wiod.org. You can download these files with the pymrio automatic downloader as described at WIOD download.

In the most simple case you get the full WIOD database with:


In [1]:
import pymrio

In [2]:
wiod_storage = '/tmp/mrios/WIOD2013'

In [3]:
wiod_meta = pymrio.download_wiod2013(storage_folder=wiod_storage)

This download the whole 2013 release of WIOD including all extensions.

The extension (satellite accounts) are provided as zip files. You can use them directly in pymrio (without extracting them). If you want to have them extracted, create a folder with the name of each extension (without the ending ".zip") and extract the zip file there.

Parsing

Parsing a single year

A single year of the WIOD database can be parse by:


In [4]:
wiod2007 = pymrio.parse_wiod(year=2007, path=wiod_storage)

Which loads the specific year and extension data:


In [5]:
wiod2007.Z.head()


Out[5]:
region AUS ... RoW
sector AtB C 15t16 17t18 19 20 21t22 23 24 25 ... 63 64 J 70 71t74 L M N O P
region sector
AUS AtB 3784.749470 33.520510 13821.807920 474.033810 136.300060 810.877200 234.948790 0.000000 185.784570 81.938000 ... 10.481874 0.000808 0.031735 0.023280 5.861476 1.123848 25.333019 4.291562 4.874767 0.000791
C 26.253436 6671.832980 324.993193 20.785395 5.976473 26.981388 105.029472 6659.692127 352.992634 34.737431 ... 0.220334 0.028363 0.004541 0.081185 5.442078 0.292077 0.232191 0.310890 0.443509 0.001000
15t16 929.958296 81.490230 6201.543062 60.054879 17.267720 13.588882 45.246115 24.007404 754.675350 50.919526 ... 0.936095 1.495263 3.829824 2.434498 13.989495 8.138864 133.900410 48.045408 62.537153 0.001805
17t18 31.971488 33.970751 95.871008 295.911795 85.084218 16.340238 43.536115 9.525953 39.101829 38.656918 ... 0.560207 0.367082 0.651173 0.779275 3.215393 5.515491 0.854378 2.059234 3.027687 0.001752
19 8.244949 8.760528 24.723640 76.311042 21.941895 4.213893 11.227285 2.456595 10.083753 9.969017 ... 0.050365 0.033002 0.058544 0.070061 0.289079 0.495869 0.076813 0.185135 0.272204 0.000157

5 rows × 1435 columns


In [6]:
wiod2007.AIR.F


Out[6]:
region AUS ... RoW
sector AtB C 15t16 17t18 19 20 21t22 23 24 25 ... 63 64 J 70 71t74 L M N O P
stressor
CO2 6.367691e+03 2.365858e+04 3126.525484 409.176104 96.323715 152.732847 2170.361889 8058.147997 9119.700257 82.396753 ... 4.519067e+04 22917.441324 17723.690229 13910.567504 5.601616e+04 1.098584e+05 23671.960753 4.305903e+04 4.631917e+04 0.0
CH4 3.221551e+06 1.368899e+06 1213.871992 43.759118 6.252038 64.497627 196.132563 33393.021316 778.097344 24.219940 ... 2.066574e+04 2367.344909 4044.853398 6769.992126 1.631978e+04 8.902853e+04 4809.795338 1.357472e+04 1.341403e+07 0.0
N2O 6.460006e+04 1.209250e+02 519.404359 11.081322 1.358277 14.745548 111.627792 146.815518 9240.259497 6.956387 ... 7.461038e+02 320.047984 356.817406 269.634242 1.250597e+03 3.028098e+03 266.198531 7.628004e+03 9.028870e+04 0.0
NOX 1.755811e+05 1.722916e+05 68672.002050 4040.886651 1012.797200 9028.943174 36118.410462 20162.149026 32405.126521 643.318443 ... 1.590800e+05 93897.479993 77084.038042 81937.152824 2.207988e+05 4.710649e+05 105912.353518 1.790062e+05 1.693474e+05 0.0
SOX 1.658225e+04 4.307541e+04 46636.439902 1010.280269 253.213989 2257.366743 17059.702285 108904.020068 79131.591852 160.838941 ... 5.841325e+04 34478.601877 28304.804973 30086.840151 8.107600e+04 1.729722e+05 38890.392703 6.573001e+04 6.218337e+04 0.0
CO 1.512935e+06 8.801313e+05 247496.408649 20642.389652 5173.754239 46123.284133 90805.126903 65080.776447 406113.713306 3286.315879 ... 1.124907e+06 663979.652027 545086.329897 579404.284591 1.561340e+06 3.331053e+06 748940.734503 1.265811e+06 1.197511e+06 0.0
NMVOC 3.999910e+05 2.800153e+05 148660.535247 6567.410709 1646.038543 14674.199801 31944.464014 127366.360161 111694.012236 1045.546880 ... 3.455864e+05 203983.475230 167457.848344 178000.785375 4.796646e+05 1.023344e+06 230084.661930 3.888741e+05 3.678914e+05 0.0
NH3 5.199660e+05 4.613353e+02 108.576568 4.412711 0.462632 13.142829 47.789610 4.104788 358.482070 4.786318 ... 4.530937e+02 316.828348 233.201236 313.192459 1.620282e+03 1.332001e+03 107.031855 5.911219e+02 4.808552e+03 0.0

8 rows × 1435 columns

If a WIOD SEA file is present (at the root of path or in a folder named 'SEA' - only one file!), the labor data of this file gets included in the factor_input extension (calculated for the the three skill levels available). The monetary data in this file is not added because it is only given in national currency:


In [7]:
wiod2007.SEA.F


Out[7]:
region AUS ... RoW
sector AtB C 15t16 17t18 19 20 21t22 23 24 25 ... 63 64 J 70 71t74 L M N O P
inputtype
EMP 349.906604 147.955799 189.229541 49.152618 4.174751 52.350134 124.076825 5.886915 46.400859 37.624869 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
EMPE 177.972976 145.153389 183.691303 40.240016 3.168873 44.836024 117.458029 5.859025 45.338232 36.800479 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
H_EMP 743.950259 326.446887 365.287608 89.988634 8.279106 108.256975 229.727320 11.710741 89.721636 73.069805 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
H_EMPE 367.588214 321.341746 351.470490 74.647046 6.197284 92.854499 218.041008 11.684120 88.045761 71.235855 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

4 rows × 1435 columns

Provenance tracking and additional meta data is availabe in the field meta:


In [8]:
print(wiod2007.meta)


Description: WIOD metadata file for pymrio
MRIO Name: WIOD
System: industry-by-industry
Version: data13
File: /tmp/mrios/WIOD2013/metadata.json
History:
20191007 12:43:31 - FILEIO -  Extension wat parsed from /tmp/mrios/WIOD2013
20191007 12:43:30 - FILEIO -  Extension mat parsed from /tmp/mrios/WIOD2013
20191007 12:43:29 - FILEIO -  Extension lan parsed from /tmp/mrios/WIOD2013
20191007 12:43:28 - FILEIO -  Extension EU parsed from /tmp/mrios/WIOD2013
20191007 12:43:25 - FILEIO -  Extension EM parsed from /tmp/mrios/WIOD2013
20191007 12:43:23 - FILEIO -  Extension CO2 parsed from /tmp/mrios/WIOD2013
20191007 12:43:21 - FILEIO -  Extension AIR parsed from /tmp/mrios/WIOD2013
20191007 12:43:20 - FILEIO -  SEA file extension parsed from /tmp/mrios/WIOD2013
20191007 12:43:09 - METADATA_CHANGE -  Changed parameter "system" from "IxI" to "industry-by-industry"
20191007 12:43:09 - FILEIO -  WIOD data parsed from /tmp/mrios/WIOD2013/wiot07_row_apr12.xlsx
 ... (more lines in history)

WIOD provides three different sector/final demand categories naming schemes. The one to use for pymrio can specified by passing a tuple names= with:

1) 'isic': ISIC rev 3 Codes - available for interindustry flows and final demand rows.

2) 'full': Full names - available for final demand rows and final demand columns (categories) and interindustry flows.

3) 'c_codes' : WIOD specific sector numbers, available for final demand rows and columns (categories) and interindustry flows.

Internally, the parser relies on 1) for the interindustry flows and 3) for the final demand categories. This is the default and will also be used if just 'isic' gets passed ('c_codes' also replace 'isic' if this was passed for final demand categories). To specify different finial consumption category names, pass a tuple with (sectors/interindustry classification, fd categories), eg ('isic', 'full'). Names are case insensitive and passing the first character is sufficient.

For example, for loading wiod with full sector names:


In [9]:
wiod2007_full = pymrio.parse_wiod(year=2007, path=wiod_storage, names=('full', 'full'))
wiod2007_full.Y.head()


Out[9]:
region AUS AUT ... USA RoW
category Final consumption expenditure by households Final consumption expenditure by non-profit organisations serving households (NPISH) Final consumption expenditure by government Gross fixed capital formation Changes in inventories and valuables Final consumption expenditure by households Final consumption expenditure by non-profit organisations serving households (NPISH) Final consumption expenditure by government Gross fixed capital formation Changes in inventories and valuables ... Final consumption expenditure by households Final consumption expenditure by non-profit organisations serving households (NPISH) Final consumption expenditure by government Gross fixed capital formation Changes in inventories and valuables Final consumption expenditure by households Final consumption expenditure by non-profit organisations serving households (NPISH) Final consumption expenditure by government Gross fixed capital formation Changes in inventories and valuables
region sector
AUS Agriculture, Hunting, Forestry and Fishing 8222.798980 0.0 184.205180 2924.034910 1280.356810 0.422485 0.0 0.025177 0.000000 0.0 ... 69.083262 0.0 0.0 0.000000 0.0 107.088905 0.0 1.798976 10.713377 0.000770
Mining and Quarrying 2525.696909 0.0 137.230459 4150.190757 -292.042008 0.666800 0.0 0.000000 0.012719 0.0 ... 0.490308 0.0 0.0 0.764753 0.0 0.088067 0.0 0.004956 0.202258 -0.004381
Food, Beverages and Tobacco 28619.069479 0.0 54.444946 457.899386 404.590962 5.606114 0.0 0.037221 0.031606 0.0 ... 1631.773339 0.0 0.0 0.554414 0.0 2918.131643 0.0 0.969600 3.599341 0.001523
Textiles and Textile Products 1837.921033 0.0 8.595108 453.941827 -42.196861 1.522250 0.0 0.006089 0.050338 0.0 ... 158.781552 0.0 0.0 4.737164 0.0 86.189090 0.0 0.969294 2.892659 0.000035
Leather, Leather and Footwear 473.971219 0.0 2.216545 117.064525 -10.881914 0.476768 0.0 0.001907 0.015766 0.0 ... 49.730261 0.0 0.0 1.483677 0.0 7.748815 0.0 0.087144 0.260064 -0.000005

5 rows × 205 columns

The wiod parsing routine provides some more options - for a full specification see the API reference

Parsing multiple years

Multiple years can be passed by running the parser in a for loop.