diff --git a/app/index.py b/app/index.py index fbebc84..326da07 100644 --- a/app/index.py +++ b/app/index.py @@ -80,10 +80,13 @@ def nodes_dict_to_dataframe(nodes: dict) -> pd.DataFrame: A dataframe with human-readable descriptions and emissions values of the nodes in the graph traversal. """ list_of_row_dicts = [] - for i in range(0, len(nodes)): - current_node: Node = nodes[i] + for current_node in nodes.values(): + scope_1: bool = False - if current_node.unique_id == 0: + + if current_node.unique_id == -1: + continue + elif current_node.unique_id == 0: scope_1 = True else: pass @@ -101,7 +104,7 @@ def nodes_dict_to_dataframe(nodes: dict) -> pd.DataFrame: return pd.DataFrame(list_of_row_dicts) -def edges_dict_to_dataframe(edges: dict) -> pd.DataFrame: +def edges_dict_to_dataframe(edges: list) -> pd.DataFrame: """ To be added... """ @@ -109,8 +112,7 @@ def edges_dict_to_dataframe(edges: dict) -> pd.DataFrame: return pd.DataFrame() else: list_of_row_dicts = [] - for i in range(0, len(edges)-1): - current_edge: Edge = edges[i] + for current_edge in edges: list_of_row_dicts.append( { 'consumer_unique_id': current_edge.consumer_unique_id, diff --git a/dev/edit_graph.py b/dev/edit_graph.py new file mode 100644 index 0000000..df84166 --- /dev/null +++ b/dev/edit_graph.py @@ -0,0 +1,12 @@ +import pandas as pd + +# %% + +data = { + 'uid': [0, 1, 2, 3], + 'description': ['cardboard', 'paper', 'wood', 'electricity'], + 'production': [True, False, True, False], + 'emissions_intensity': [1.5, 2.2, 0.7, 0.2], +} + +df = pd.DataFrame(data) \ No newline at end of file diff --git a/dev/trace_branch.py b/dev/trace_branch.py index 77dc570..9814577 100644 --- a/dev/trace_branch.py +++ b/dev/trace_branch.py @@ -51,10 +51,13 @@ def nodes_dict_to_dataframe(nodes: dict) -> pd.DataFrame: A dataframe with human-readable descriptions and emissions values of the nodes in the graph traversal. """ list_of_row_dicts = [] - for i in range(0, len(nodes)-1): - current_node: Node = nodes[i] + for current_node in nodes.values(): + scope_1: bool = False - if current_node.unique_id == 0: + + if current_node.unique_id == -1: + continue + elif current_node.unique_id == 0: scope_1 = True else: pass diff --git a/pyodide/index.html b/pyodide/index.html index 5e6d623..3b469ad 100644 --- a/pyodide/index.html +++ b/pyodide/index.html @@ -3,7 +3,7 @@