How to update a value to a appropriate place if the dictionary has single key multiple values?

52 views Asked by At

I have a CSV file with header task;a1_data;a2_data;a3_data. I have considered task as key and rest of the columns as values. a1,a2,a3 are variables here. When the input value is a1 it should update the column 'a1_data', when its is a2 it should update the column 'a2_data' and when the values is equal to a3 it should update column 'a3_data'.

with open(data_file, 'r', newline="\n") as data_List:
    for row in data_List:
        row = str(row).strip("\r\n ")
        x = row.split(";")
        index_data[x[0]] = x[1:]

Till here i was able to do it but confused on updating of the column. can anyone please help me in this?

0

There are 0 answers