调用.to_excel时出现“未处理的异常:必须至少可见一张纸”

时间:2019-04-07 16:34:13

标签: python excel pandas

我正在尝试将多个工作表写入同一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

0 个答案:

没有答案