I'd like to read an excel table with Panda, and create a list of tuples. Then, I want to convert the list into a dictionary which has a tuple as key. How can I do that?
Here is the table that I am reading;
A B 0.6
A C 0.7
C D 1.0
C A 1.2
D B 0.7
D C 0.6
Here is how I read my table;
import pandas as pd
df= pd.read_csv("my_file_name.csv", header= None)
my_tuple = [tuple(x) for x in df.values]
Now, I want to have the following structure.
my_data = {("A", "B"): 0.6,
("A", "C"): 0.7,
("C", "D"): 1,
("C", "A"): 1.2,
("D", "B"): 0.7,
("D", "C"): 0.6}