欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Python3对比合并Excel表格

程序员文章站 2022-09-04 19:12:28
##安装模块pip install pandas as pdpip install xlsxwriterpip install openpyxl ##带入模块import pandas as pdimport xlsxwriterimport openpyxl df1 = pd.read_excel ......

##安装模块
pip install pandas as pd
pip install xlsxwriter
pip install openpyxl

##带入模块
import pandas as pd
import xlsxwriter
import openpyxl

df1 = pd.read_excel('4.xlsx')
df2 = pd.read_excel('4_6f_工位网络面板.xlsx',sheet_name='60-old')
df3=pd.merge(df1,df2,how='left',on='net_int') #按照关键列net_int合并
print(type(df3))
df3.to_excel('88.xlsx',sheet_name='88') #输出excel