Let's say I have the following data frame.
df
Nodes Weight
A,B 10
A,C,F 8
B,F,D 6
B,E 4
I would like to split based on comma and keeping their weight as well. For example, Nodes (A,C,F) A has connection with C and C has connection F. So, I would like to see A >>C, and C>>F. No need to see A>>F. AND their weight should be 8 as well as shown below.
The final data frame that am looking for looks like below.
Node_1 Node_2 Weight
A B 10
A C 8
C F 8
B F 6
F D 6
B E 4
The goal of creating this data frame is creating a network graph out of it.
There are similar solutions but I couldn't get the result what I want.
I tried with the following:
df = (df['Nodes'].str.split(',') .groupby(df['Weight'])
Can anyone help on this?