So I am trying to make a dictionary from a csv, the first head of the csv contains 2 header, one for the word and one for the weight of the word. But everytime I try to read it, it always give the value error when I tried to make it read the string by changing it to int(str(row[1])). And that didn't work, I am really confused on how to make this dictionary
positive_dictionary.py
lexicon_positive = dict()
import csv
with open('Lexicon/positive.csv', 'r') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for row in reader:
lexicon_positive[row[0]] = int(row[1])
Lexicon/positive.csv
word,weight
hi,3
record,2
extensive,3
plenary,1
detail,2