I have data built into the form of:
Node | Depends_On
Node_3 Node_2
Node_2 Node_1
Node_4 Node_1
I have put this into a pandas dataframe. I want to get a table:
Node | Level
Node_1 1
Node_2 2
Node_3 3
Node_4 2
I know I can achieve this in Python using recursion function but I'm not really sure how to start.
I tried to to modify the answer to this: Recursive SQL CTE query in Pandas?
But I get key errors. Is it because I don't have numeric entries?