I have:
idx Node1 Node2 Immediacy
0 a C 5
1 a B 5
2 B D 3
3 B E 3
4 B F 3
and an array (verices):
array(['a', 'B', 'C', 'E', 'G', 'H', 'J', 'D', 'F', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'I', 'K'], dtype=object)
I want to add a new column/substitute all the letters in the data frame based on the index position of the array:
idx Node1 Node2 Immediacy
0 0 2 5
1 0 1 5
2 1 3 3
3 1 4 3
4 1 5 3
I found a way to find the index in the array with:
(verices=='B').argmax()
but am not sure how to use this to achieve the desired results.
any suggestions welcome