import pandas as pd
#pandas讀取excel表數據(3個excel)
pd.set_option('display.max_columns',None)
pd.set_option('display.max_rows',None)
f1 = pd.read_excel(io=r'C:\Users\wzc\Desktop\test2-1.xlsx')
f2 = pd.read_excel(io=r'C:\Users\wzc\Desktop\test2-2.xlsx')
f3 = pd.read_excel(io=r'C:\Users\wzc\Desktop\test2-3.xlsx')
#將3個excel表須要操做的數據提取到一個列表中
f = [f3,f1.iloc[:,1:4],f2.iloc[:,1:5]]
# print(f)
#建立一個test123.xlsx表
write = pd.ExcelWriter(r'C:\Users\wzc\Desktop\test123.xlsx')
# 合併行axis=1,(axis=0,默認 則爲合併列)
pd.concat(f,sort=True,axis=1).to_excel(write,'Sheet1',index=False) write.save()