I have been trying to merge two excel sheets together based on their own name columns. I used this as a reference.
In df1 the name column is Local Customer
df2 the name column is Client
import difflib
import pandas as pd
path= 'C:/Users/Rukgo/Desktop/Match thing/'
df1=pd.read_excel(path+'2015_TXNs.xls')
df2=pd.read_excel(path+'Pipeline.xls')
df2['Client'] = df2['Client'].apply(lambda x: difflib.get_close_matches(x, df1['Local Customer'])[0])
result = df1.join(df2)
result.to_excel(path+'maybe.xls')
Though when I run this I get a the following error:
File "C:/Users/Rukgo/Desktop/Match Things/untitled3.py", line 16, in <lambda>
df2['Client'] = df2['Client'].apply(lambda x: difflib.get_close_matches(x, df1['Local Customer'])[0])
IndexError: list index out of range