summaryrefslogtreecommitdiff
path: root/tableconversion.py
blob: 15e300fd709b3bd022d0198137567fb49ebec74f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)