python create dictionary from csv
mydict = {y[0]: y[1] for y in [x.split(",") for x in open('file.csv').read().split('n') if x]}
python create dictionary from csv
mydict = {y[0]: y[1] for y in [x.split(",") for x in open('file.csv').read().split('n') if x]}
how to create dictionary in python from csv
input_file = csv.DictReader(open("coors.csv"))
csv to python dictionary
pythonCopyimport pandas as pd
dict_from_csv = pd.read_csv('csv_file.csv', header=None, index_col=0, squeeze=True).to_dict()
print(dict_from_csv)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us