-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstep5.py
More file actions
54 lines (38 loc) · 1.09 KB
/
step5.py
File metadata and controls
54 lines (38 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# (c) 2022 - 2026 Open Risk (https://www.openriskmanagement.com)
import numpy as np
import pandas as pd
import pymrio
io = pymrio.IOSystem()
"""
Working with Extensions
Step 5 of the Academy Course [SFI32064](https://www.openriskacademy.com/course/view.php?id=64)
"""
sectors = ['S1', 'S2']
regions = ['R1']
Z_multiindex = pd.MultiIndex.from_product(
[regions, sectors], names=[u'region', u'sector'])
Z = pd.DataFrame(
data=np.array([
[150, 500],
[200, 100]]),
index=Z_multiindex,
columns=Z_multiindex
)
categories = ['final demand']
fd_multiindex = pd.MultiIndex.from_product(
[regions, categories], names=[u'region', u'category'])
Y = pd.DataFrame(
data=np.array([[350], [1700]]),
index=Z_multiindex,
columns=fd_multiindex)
io.Z = Z
io.Y = Y
F = pd.DataFrame(
data=np.array([[650, 1400]]),
index=['Value Added'],
columns=Z_multiindex)
factor_input = pymrio.Extension(name='Value Added', F=F)
io.factor_input = factor_input
io.factor_input.unit = pd.DataFrame(data=['USD'], index=F.index, columns=['unit'])
io.calc_all()
print(factor_input.F)