I have a data frame having 4 columns A, B, C, D. I need to visualize/ print each row of my data frame as a tree structure.
Example:
df['A'] = franchisee
df['B'] = sign off
df['C'] = status
df['D'] = registration
Then, I need to visualize this row as a tree where franchisee is the parent node of sign off, sign off is the parent node of status and child node of franchisee, status is the parent node of registration and child node of sign off, registration is the child node of status. How can I do that? I have tried using the anytree library:
from anytree import Node, RenderTree, NodeMixin
import pandas as pd
df = pd.read_csv('file_location')
for i, j, k, l in zip(df['A'], df['B'], df['C'], df['D']):
mdept = Node(a)
dept = Node(b, parent = a)
qtype = Node(c, parent = b)
sqtype = Node(d, parent = c)
but it shows the following error:
Exception has occured:TreeError
Parent node 'franchisee' is not of type 'NodeMixin'.
