how to make a dictionary in python from csv file code example
Example 1: read csv and store in dictionary python
import csv
with open('coors.csv', mode='r') as infile:
reader = csv.reader(infile)
with open('coors_new.csv', mode='w') as outfile:
writer = csv.writer(outfile)
mydict = {rows[0]:rows[1] for rows in reader}
Example 2: how to create dictionary in python from csv
input_file = csv.DictReader(open("coors.csv"))