diff options
author | Joshua Drake <joshua.ellis.drake@gmail.com> | 2024-10-30 16:46:26 -0500 |
---|---|---|
committer | Joshua Drake <joshua.ellis.drake@gmail.com> | 2024-10-30 16:46:26 -0500 |
commit | d26282ce348f70542344a331643bd15ac46740ce (patch) | |
tree | 86f188760273059d957c438e7efa639b3f60b411 |
Initial Commit.
-rw-r--r-- | tableconversion.py | 33 |
1 files changed, 33 insertions, 0 deletions
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) |