Skip to content

Instantly share code, notes, and snippets.

@konstantinstadler
Created September 27, 2019 11:33
Show Gist options
  • Save konstantinstadler/206c219ba1bacc1f206f93409f8d8134 to your computer and use it in GitHub Desktop.
Save konstantinstadler/206c219ba1bacc1f206f93409f8d8134 to your computer and use it in GitHub Desktop.
Changing Y vector
In [1]: import pymrio
In [2]: tt = pymrio.load_test().calc_all()
In [3]: tnew = tt.copy()
In [4]: Ynew = tnew.Y.copy()
In [5]: Ynew.loc['reg1', 'reg1'] = Ynew.loc['reg1', 'reg1'].values * 2
In [6]: tnew.reset_all_to_coefficients()
Out[6]: <pymrio.core.mriosystem.IOSystem at 0x7f19ef8a8d10>
In [7]: tnew.Y = Ynew
In [8]: tnew.calc_all()
Out[8]: <pymrio.core.mriosystem.IOSystem at 0x7f19ef8a8d10>
In [9]: tt.emissions.D_cba
Out[9]:
region reg1 ... reg6
sector food mining manufactoring electricity construction trade ... manufactoring electricity construction trade transport other
stressor compartment ...
emission_type1 air 2.056183e+06 179423.535893 9.749300e+07 1.188759e+07 3.342906e+06 3.885884e+06 ... 7.145075e+07 3.683167e+07 1.836696e+06 4.241568e+07 4.805409e+07 3.602298e+07
emission_type2 water 2.423103e+05 25278.192086 1.671240e+07 1.371303e+05 3.468292e+05 7.766205e+05 ... 1.068144e+07 5.728136e+05 9.069515e+05 5.449044e+07 8.836484e+06 4.634899e+07
[2 rows x 48 columns]
In [10]: tnew.emissions.D_cba
Out[10]:
region reg1 ... reg6
sector food mining manufactoring electricity construction trade ... manufactoring electricity construction trade transport other
stressor compartment ...
emission_type1 air 2.827740e+06 254259.069049 1.041142e+08 2.373261e+07 6.675139e+06 7.762721e+06 ... 7.145075e+07 3.683167e+07 1.836696e+06 4.241568e+07 4.805409e+07 3.602298e+07
emission_type2 water 2.918867e+05 26932.596075 1.694569e+07 2.735201e+05 6.888469e+05 1.544717e+06 ... 1.068144e+07 5.728136e+05 9.069515e+05 5.449044e+07 8.836484e+06 4.634899e+07
[2 rows x 48 columns]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment