I have an excel sheet with 2 columns. Column 1 is name, and Column 2 is age. I want to create a dictionary where name is key and age is value. Here is the code, but it is creating a dictionary incorrectly.
keyValues = [x.value for x in worksheet.col(0)]
data = dict((x, []) for x in keyValues)
while curr_row < num_rows:
curr_row += 1
for row_index in range(1, worksheet.nrows): data[keyValues[row_index]].append(worksheet.cell_value(curr_row, 1))
I want to have a dictionary like below coming from 2 columns of excel sheet.
{'Ann': 12, 'Maria': 3, 'Robin': 4, 'NameN':N}