Nov-06-2017, 08:17 AM
hi,
i have a csv file (attached the file with the name python_dictionary.csv)
in the attached format has three columns Key, value1 and value2.. how can i manipulate csv using python so that i can make value1 as there headers.
this is desired format(for more details please refer desiredformat.csv)
key would be different in each case.
i am not able to go beyond because i dont know how to make permanent headers
can anyone please guide?
i have a csv file (attached the file with the name python_dictionary.csv)
in the attached format has three columns Key, value1 and value2.. how can i manipulate csv using python so that i can make value1 as there headers.
this is desired format(for more details please refer desiredformat.csv)
key would be different in each case.
i am not able to go beyond because i dont know how to make permanent headers
1 2 3 4 5 6 7 8 9 10 |
import csv filename = "python_dictionary.csv" prj = {} #fdata = dict() #f = open(filename, "r") data = f.read() lst = data.split( "\n" ) for i in range ( 1 , len (lst)): #because 0 is the header val = lst[i].split( "," ) |
Attached Files

