Hej I have currently 2 data rames from 2 different excel files
- a=df_Web_Customer
- b=df_Batchlog
Example
dfa = pd.DataFrame([[Casper May 16 2020], [Kasper Apr 1 2014], [Jonas Jan 15 2016]], columns=['Name'])
dfb = pd.DataFrame([[Casper May 16 2020], [Jonas Apr 1 2014], [Jona Jan 5 2016]], columns=['Name'])
I have a function that can compare 2 inputs with each other: SequenceMatcher
How do i take one cell at a time from Dataframe a and match it with each cell in Dataframe b?
My end goal is to then develop an if statement sorting the biggest matches, but i have not been able to find any similar cases here on stack so i hope any help could be provided :)
THE CODE:
from difflib import SequenceMatcher
import pandas as pd
#import zip
#Load Web customer to Data frame
data_web_customer = pd.read_excel (r'NewWeb_customer.xlsx')
df_Web_Customer = pd.DataFrame(data_web_customer, columns= ['Name'])
#Load Batchlog to Data frame
data_Batchlog = pd.read_excel (r'BatchlogTestName.xlsx')
df_Batchlog = pd.DataFrame(data_Batchlog, columns= ['Name'])
a=df_Web_Customer
b=df_Batchlog
#LOOP the SIMILAR FUNCTION through each cell??
def similar(a, b):
return SequenceMatcher(None, a, b).ratio()