jianlei
8/22/2018 - 3:26 AM

用Pandas实现Excel的VLookup函数

用Pandas实现Excel的VLookup函数

#!/usr/bin/env python3
# _*_ coding: utf-8 _*_


import pandas as pd

df1 = pd.read_excel("/Users/daren/Downloads/1.xlsx", sheet_name=0)
df2 = pd.read_excel("/Users/daren/Downloads/1.xlsx", sheet_name=1)

c = df1.merge(df2, on="Name", how="right")
# c=pd.merge(a,b,how='right')
# print(c.head())
c.to_excel('3.xlsx', sheet_name='result')