How can I convert the below dataframe to a dictionary where the key is values of 'node' and the value is values of 'label'?
label node
0 False 254
1 False 255
2 False 256
3 False 260
4 False 261
How can I convert the below dataframe to a dictionary where the key is values of 'node' and the value is values of 'label'?
label node
0 False 254
1 False 255
2 False 256
3 False 260
4 False 261
You can zip
the two columns together:
>>> dict(zip(df["node"], df["label"]))
{254: False, 255: False, 256: False, 260: False, 261: False}