我有以下代码来设置工作表,其中我正在使用xlsxwriter创建报告
workbook = xlsxwriter.Workbook(f'{FUNDNAME}.xlsx')
worksheet = workbook.add_worksheet('Summary')
worksheet2 = workbook.add_worksheet('Data')
我所有的代码都能正常工作,直到尝试将pandas数据框写入“数据”标签
writer = pd.ExcelWriter(f'{FUNDNAME}.xlsx')
df.to_excel(writer,sheet_name = 'Data')
writer.save()
writer.close()
但是当我打开文件时,“数据”选项卡为空白。我在做什么错了?