艺赛旗 RPA10.0全新首发免费下载 点击下载
www.i-search.com.cn/index.html?from=line1
1. 读取数据
import openpyxl
import pandas as pd
df1 = pd.DataFrame(pd.read_excel(‘table1.xls’,sheet_name = ‘Sheet1’))
df2 = pd.DataFrame(pd.read_excel(‘table2.xls’,sheet_name = ‘Sheet1’))
2. 实现 vlookup 功能
#只在table1添加分数列,不添加排名列
result = pd.merge(df1,df2.loc[:,[‘学号’,‘分数’]],how=‘left’,on = ‘学号’)
3. 保存结果
writer = pd.ExcelWriter(‘result.xlsx’)
result.to_excel(writer,index=False)
writer.save()
4 . 注意事项
点击阅读 =>excel 过滤等操作异常