0

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()
Shawn Atlas
  • 25
  • 1
  • 7
  • Welcome to Stackoverflow. Please take the time to read this post on [how to provide a great pandas example](http://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) as well as how to provide a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve) and revise your question accordingly. These tips on [how to ask a good question](http://stackoverflow.com/help/how-to-ask) may also be useful. – jezrael May 28 '20 at 10:21
  • @jezrael thanks for the heads-up i can see i missed some things, but it should look better now right? :) – Shawn Atlas May 28 '20 at 10:36

0 Answers0