Python Forum
finding exact and similar matches from pandas dataframe? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: finding exact and similar matches from pandas dataframe? (/thread-9665.html)



finding exact and similar matches from pandas dataframe? - PrateekG - Apr-22-2018

I have cleaned some data and created two dataframes.
Each dataframe has one column and this column contains product category names like- df1['ecommerce_cataegory_name'] & df2['my_category_name'].
These two columns are type object.
What I need to do is write a function which can-
1. find exact match between two columns and give the name
2. if no exact match found then give 3 most similar names
3. Then save above result in a csv file with column names as 'exact_match','similar_1','similar_2'and 'similar_3'.
Please suggest efficient way/solution to achieve this problem using Python 3.6.