I'm using xlrd to read a xlsx file as a csv. For this purpose I'm using the following code:
workbook = xlrd.open_workbook("170519_taxonomy_in_qiime.xlsx")
sheet = workbook.sheet_by_index(0)
source_data = [sheet.row_values(rowx) for rowx in range(sheet.nrows)]
Which gives me this example result
[[225145.0, 'k__Bacteria', ' p__ZB3', ' c__Rs-J96', ' o__', ' f__', ' g__', ' s__'], [2916972.0, 'k__Bacteria', ' p__ZB3', ' c__Rs-J96', 'o__', ' f__', ' g__', ' s__']]
But I need my result to look like this:
[['225145.0, k__Bacteria, p__ZB3, c__Rs-J96, o__, f__, g__, s__'], ['2916972.0, k__Bacteria, p__ZB3, c__Rs-J96, o__, f__, g__, s__']]
Any Idea how can do this?
jointhe inner list to obtain the result...xlsxinto acsvthis might answer your question: stackoverflow.com/questions/22688477/…