I have a dictionary, 'values', in Python. The 'values' contains lists of integers, except the 'RowHeaders'. I would like to have the 'RowHeaders' as the first column in the excel file. In the following code, I cannot add a condition in 'from_items' method to put it as the first column. When I run this code, it doesn't put the 'RowHeaders' data in the first column.
values['RowHeaders'] = list_of_headers
for feat in features:
values.setdefault(feat, list())
for p in data:
values[feat].append(int(data[p][feat]))
writer = pd.ExcelWriter('output.xlsx')
df = pd.DataFrame.from_items([(f,values[f]) for f in values])
df.to_excel(writer, 'Sheet1', index=False)
writer.save()
Thanks.