Reputation: 8202
I have an Excel data set:
"id","value","name"
1 , 10, "cat"
2 , 20, "fish"
In Python:
import xlrd
col1 = "id"
col2 = "value"
col3 = "name"
wb = xlrd.open_workbook("file.xls")
sh = wb.sheet_by_index(0)
result = sh.someMethod((col1,col3))?????
Is there a method that will return the columns by name?
print result
[[1,"cat"],[2,"fish"]]
Upvotes: 0
Views: 1698
Reputation: 59440
col_slice might be suitable, for example:
zip(sh.col_slice(0,1),sh.col_slice(2,1))
Upvotes: 2