From 45dc3bdac7e7e709071a3382a7d5c528ab943f76 Mon Sep 17 00:00:00 2001 From: Michael Weinold <23102087+michaelweinold@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:03:26 +0200 Subject: [PATCH 1/2] initial commit --- app/index.py | 9 ++++-- dev/edit_graph.py | 12 +++++++ pyodide/index.html | 81 +++++++++++++++++++++++----------------------- pyodide/index.js | 4 +-- requirements.txt | 2 +- 5 files changed, 62 insertions(+), 46 deletions(-) create mode 100644 dev/edit_graph.py diff --git a/app/index.py b/app/index.py index fbebc84..a44050c 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 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/pyodide/index.html b/pyodide/index.html index 5e6d623..c81323f 100644 --- a/pyodide/index.html +++ b/pyodide/index.html @@ -3,7 +3,7 @@