pandas将不同excel(DataFrame)合并到同一个excel的不同sheet(工作表)

直接上代码:

import pandas as pd

# 读取表格
re=pd.read_excel('total_data.xlsx')
re2=pd.read_excel('total_data2.xlsx')
hot_topic=pd.read_excel('热门.xlsx')
high_freq=pd.read_excel('高频.xlsx')
question_=pd.read_excel('高频问题.xlsx')

#合并excel到不同的sheet
writer=pd.ExcelWriter('材料总表.xlsx', enginge='openpyxl')   #定义writer

re.to_excel(writer,'原始表(35698)') # writer---writer;sheet名称---原始表(35698)
re2.to_excel(writer,'去重后(26292)')
question_.to_excel(writer,'高频问题排序(5729)')
hot_topic.to_excel(writer,'热门(458)')
high_freq.to_excel(writer,'高频(2793)')

#保存
writer.save()

样式:

你可能感兴趣的:(Python,pandas)