Python Creating Dictionary from excel data

后端 未结 6 764
梦毁少年i
梦毁少年i 2020-11-30 08:48

I want to create a dictionary from the values, i get from excel cells, My code is below,

wb = xlrd.open_workbook(\'foo.xls\')
sh = wb.sheet_by_index(2)   
f         


        
6条回答
  •  误落风尘
    2020-11-30 09:44

    or you can try pandas

    from pandas import *
    xls = ExcelFile('path_to_file.xls')
    df = xls.parse(xls.sheet_names[0])
    print df.to_dict()
    

提交回复
热议问题