I have a data frame in the form:
index Name_A Name_B
0 Adam Ben
1 Chris David
2 Adam Chris
3 Ben Chris
And I would like to get an adjacency matrix for Name_Aand Name_B, that is:
Adam Ben Chris David
Adam 0 1 1 0
Ben 0 0 1 0
Chris 0 0 0 1
David 0 0 0 0
What is the most python / scalable way to solve this problem?
EDIT: Also, I know that if the set row Adam, Benis in the data set, then at another point, Ben, Adamit will also be in the data set.
source
share