I have to update a dataframe based on a dependency value. How can this be done?
For example, input dataframe df:
id dependency
10
20 30
30 40
40
50 10
60 20
Here we have:
20 -> 30 and 30 -> 40. So the final result will be 20 -> 40 and 30 -> 40.
In the same way, 60 -> 20 -> 30 -> 40 so final result will be 60 -> 40.
Final result:
id dependency final_dependency
10
20 30 40
30 40 40
40
50 10 10
60 20 40