From d26282ce348f70542344a331643bd15ac46740ce Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Wed, 30 Oct 2024 16:46:26 -0500 Subject: Initial Commit. --- tableconversion.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tableconversion.py diff --git a/tableconversion.py b/tableconversion.py new file mode 100644 index 0000000..15e300f --- /dev/null +++ b/tableconversion.py @@ -0,0 +1,33 @@ +import yaml +import pandas as pd + +def parse_wireviz_yml(file_path): + # Load the WireViz YML file + with open(file_path, 'r') as file: + data = yaml.safe_load(file) + + # Extract the wires and their terminating points + wires = data.get('wires', []) + wire_info = [] + + for wire in wires: + wire_name = wire.get('name') + from_point = wire.get('from') + to_point = wire.get('to') + + wire_info.append({ + 'Wire Name': wire_name, + 'From': from_point, + 'To': to_point + }) + + # Create a DataFrame to display the data as a table + wire_df = pd.DataFrame(wire_info, columns=['Wire Name', 'From', 'To']) + return wire_df + +# Path to your WireViz YML file +file_path = 'your_wireviz_file.yml' +wire_table = parse_wireviz_yml(file_path) + +# Display the table +print(wire_table) -- cgit v1.2.3