diff --git a/epyt/examples/python/EX_to_excel_json.py b/epyt/examples/python/EX_to_excel_json.py index 6617a15..dcf6a20 100644 --- a/epyt/examples/python/EX_to_excel_json.py +++ b/epyt/examples/python/EX_to_excel_json.py @@ -57,5 +57,24 @@ comp_values.to_excel(f"to_excel_{selected_attribute}_example", attributes=selected_attribute) +# Retrieve node and link IDs from the network +nodeid = d.getNodeNameID() +linkid = d.getLinkNameID() + +# Below are four example scenarios demonstrating how to use comp_values.to_excel() +# with different parameter configurations: + +# 1) Scenario 1: Include both index and node/link IDs in the output. +comp_values.to_excel("case1", node_id_list=nodeid, link_id_list=linkid, both=True) + +# 2) Scenario 2: Include only node/link IDs (no index). +comp_values.to_excel("case2", node_id_list=nodeid, link_id_list=linkid, both=False) + +# 3) Scenario 3: Use the default settings (only index is included). +comp_values.to_excel("case3") + +# 4) Scenario 4: Use the default settings but suppress the column headers. +comp_values.to_excel("case4", header=False) + # Unload library d.unload() diff --git a/epyt/examples/python/EX_toexcel.py b/epyt/examples/python/EX_toexcel.py deleted file mode 100644 index f03f422..0000000 --- a/epyt/examples/python/EX_toexcel.py +++ /dev/null @@ -1,13 +0,0 @@ -from epyt import epanet - -d = epanet("Net1.inp") -x = d.getComputedTimeSeries() - -nodeid = d.getNodeNameID() -linkid = d.getLinkNameID() - -x.to_excel("case1",node_id_list = nodeid, link_id_list = linkid, both = True) #index and ids -x.to_excel("case2",node_id_list = nodeid, link_id_list = linkid, both = False) #only id -x.to_excel("case3") #default case only index -x.to_excel("case4",header = False) #default case without headers -d.unload() \ No newline at end of file