保存1table.to_excel('文件名.xlsx',index=False)pd.to_excel()一个excel文件保存多个工作表1234567891011121314import pandas as pdA = [[1,2,3],[4,5,6]]B = [[7,8,9],[10,11,12]]df1 = pd.DataFrame(A)df2 = pd.DataFrame(B)from openpyxl import load_workbook #先创建一个本地 2017.xlsx 文件book = load_workbook("2017.xlsx")writer = pd.ExcelWriter("2017.xlsx", engine='openpyxl')writer.book = bookdf1.to_excel(writer,sheet_name="A")df2.to_excel(writer,sheet_name="B")writer.save()#这样df1和df2数据分别就在文件2017.xlsx中的A和B工作表中