1

I have the first dataframe like this :

Code Name
1    Smd Ananda k 200 Gr
2    Lactgen Low Lactose
3    Bulb Surya 1 pcs
4    A1 Foods 500GR

..and the second dataframe as:

Brand
Surya
Brisk
Smd
Lctgen

I want to create a new dataframe with the Brand column, something like below:

Code Name Brand
1    Smd Ananda k 200 Gr    Smd
2    Lactgen Low Lactose    Lctgen
3    Bulb Surya 1 pcs    Surya 
4    A1 Foods 500GR    Nan

I am still learning Pandas, but unable to get any fuzzy matching login in the documentation. Could you please help me here. Thank you in advance

Devesh Kumar Singh
  • 20,259
  • 5
  • 21
  • 40
  • Have a look at the Levenshtein distance. It calculates the number of characters you need to come from one string to another. For your Lctgen => Lactgen this would be 1. If you implement a clever way to compare the components of the first dataframe to the second, this should bring good results (given that the different components in one dataframe are significantly different from each other) – Uwe Ziegenhagen Jun 25 '19 at 06:50
  • might be also worth taking a look at [this](https://stackoverflow.com/questions/56521625/quicker-way-to-perform-fuzzy-string-match-in-pandas#56521804) answer. – anky Jun 25 '19 at 06:51

0 Answers0