我正在尝试将多个工作表写入同一excel文件。我正在使用ExcelWriter,当我调用.to_excel时,出现以下错误:“必须至少可见一张纸”。这是我要运行的代码:
pathresults = "C:/Users/SVR/SVRresults/"
filesufix = str(_kernel)
filenameTRpred='predicted_train_'+ filesufix + '.xlsx'
filenameTEpred='PredictedNewData_'+ filesufix +'.xlsx'
with pd.ExcelWriter(filenameTRpred) as TR_writer:
with pd.ExcelWriter(filenameTEpred) as TE_writer:
# unrelated code...
sheetName = "no-degree_" + str(_C) + "_" + str(_epsilon)
# _C and _epsilon are float values
export_excel_TR = delta.to_excel (TR_writer, pathresults+filenameTRpred, index = None, header=True, sheet_name = sheetName) # this line triggers the error