-
Notifications
You must be signed in to change notification settings - Fork 0
/
input.py
59 lines (41 loc) · 1.96 KB
/
input.py
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
55
56
57
58
59
import pandas as pd
import os, sys
import json
from utils import reverse_nested_dict
sys.path.append(os.path.dirname(__file__))
folder_data = os.path.join(os.path.dirname(__file__), 'data', 'scenarios')
folder_assets = os.path.join(os.path.dirname(__file__), 'assets')
with open(os.path.join(folder_assets, 'colors.json')) as f:
colors_attributes = json.load(f)
scenarios = [f for f in os.listdir(folder_data) if f not in ['log.txt', '.DS_Store', 'img']]
folders = {scenario: os.path.join(folder_data, scenario) for scenario in scenarios}
detailed = {
scenario.replace('_', ' '): pd.read_csv(os.path.join(folders[scenario], 'detailed.csv'), index_col=[0]).T for
scenario in
scenarios}
detailed = reverse_nested_dict(detailed)
detailed = {key: pd.DataFrame(item) for key, item in detailed.items()}
stock = {
scenario.replace('_', ' '): pd.read_csv(os.path.join(folders[scenario], 'stock.csv'), index_col=[0, 1, 2, 3, 4, 5])
for scenario in scenarios}
scenarios = [scenario.replace('_', ' ') for scenario in scenarios]
order = {
'Energy performance': ['G', 'F', 'E', 'D', 'C', 'B', 'A', 'BBC', 'BEPOS'],
'Housing type': ['Single-family', 'Multi-family'],
'Occupancy status': ['Homeowners', 'Landlords', 'Social-housing'],
'Income class': ['C1', 'C2', 'C3', 'C4', 'C5'],
'Income class owner': ['C1', 'C2', 'C3', 'C4', 'C5'],
'Heating energy': ['Power', 'Natural gas', 'Oil fuel', 'Wood fuel']
}
color_policies = {
'Cee taxes (euro)': 'lightcoral',
'Carbon tax (euro)': 'black',
'Cee subsidy (euro)': 'lightcoral',
'Eptz subsidy (euro)': 'darkolivegreen',
'Reduced tax (euro)': 'green',
'Cite (euro)': 'red'
}
subsidies = {subsidy: detailed[subsidy] for subsidy in color_policies.keys()}
subsidies = reverse_nested_dict(subsidies)
subsidies = {key: pd.DataFrame(item) for key, item in subsidies.items()}
scenarios_table = pd.read_csv(os.path.join(folder_assets, 'scenario.csv'), index_col=None, header=[0]).dropna()