I know this may be fairly simple for some, buy I am new to python.
I have been looking for a way to write a program specifically for a column on the Excel spreadsheet. An Example (taken from a previous question)
Name Date Age Sex Color
Ray May 25.1 M Gray
Alex Apr 22.3 F Green
Ann Jun 15.7 F Blue
I need all of Alex's information in his row to be displayed when i type Alex. The spreadsheet I am using has thousands of names where everything in the first column is different. I already imported xlrd and the spreadsheet to python (2.7).
Please Help!
My code which i am having problems executing.
from collections import namedtuple Entry = namedtuple('Entry', 'FQDN Primary Secondary') import xlrd file_location = "/Users/abriman26/Desktop/Book1.xlsx" ss_dict = {} spreadsheet = file_location = "/Users/abriman26/Desktop/Book1.xlsx" for row in spreadsheet: entry = Entry(*tuple(row)) ss_dict[entry.Name] = entry
and the error message
Traceback (most recent call last):
File "<pyshell#114>", line 2, in <module>
entry = Entry(tuple(row))
TypeError: __new__() takes exactly 6 arguments (2 given)