From an Excel-File I want to import the informations for the edges via a pandas dataframe. I'm close to the finish line, but I got to it with a little tweak, which is not optimal.
Graphviz creates edges with the following command, e.g. connecting node "A" and node "B"
f.edge('0' , '1', label='')
So for the time beeing I create the graphs nodes with the following command:
#Create Graph Nodes and interconnecting Edges
for index, row in df.iterrows():
f.edge(row["Node_ID"], row["Follow_Node"], label='')
The dataframe should include only the letters of the nodes and their following nodes and should be transformed into edges of the graph. I created the graph successfully. However, the node data in the Excel file is put into single quotation marks, because Graphviz needs the node name put into these. These quotation marks show up in the final graph, which shouldn't happen in the best case.
So one entry of an Excel node column looks like this: '1'. I want to be able to just put 1 without quotation marks in the Excel file. However, when I delete the quotation marks from the Excel file and the respective dataframe Graphviz throws errors. You can see the actual data frame content below:
What could be potential solution to get rid of the quotation marks?
Thank you all in advance!
Took a walk in the nightly fresh air. The simple answer just popped up:
I changed the for function to read the row data and transform it into string data:
#Create Graph Nodes and interconnecting Edges
for index, row in df.iterrows():
f.edge(str(row["Node_ID"]), str(row["Follow_Node"]), label='')
I hope I can help other folks who are struggeling the same way in the future. Thank you to everybody who looked into my question!