Это мой код, и я могу открыть файл Excell в порядке:
# Create a Pandas Excel writer using XlsxWriter as the engine.
writer = pd.ExcelWriter('PR_weatherGDDid.xlsx')
data = [['AMN987','Ok'],['AMN987','Ok'],['AMN987','Error'], ['BBB987','Ok'],['BBB987','Ok'],['CCC','Error']]
df = pd.DataFrame(data, columns=['Serial', 'Status'])
days_to = [['02/08/19',4],['02/08/19',8],['02/08/19',3], ['02/08/19',6],['02/08/19',0],['02/08/19',9]]
doystats = pd.DataFrame(days_to, columns=['Date', 'Day'])
# Write each dataframe to a different worksheet.
df.to_excel(writer, sheet_name='Daily', index=False)
doystats.to_excel(writer, sheet_name='stats')
# Close the Pandas Excel writer and output the Excel file.
writer.save()
writer.close()
Вывод выглядит так:
