I want to return a new column on my dataframe with the word more similar to my pandas column value (in this case col1). My actual dataframe is:
And I have the following list:
['Product_A1', 'Product_B1', 'Product_C']
And my output should be:
For that I am using the following code (i'm just printing the results):
import pandas as pd
import difflib
d = {'col1': ['Product_Z1', 'Product_A', 'Product_B'], 'col2': [1, 2, 3]}
df = pd.DataFrame(data=d)
products_list = ['Product_A', 'Product_B', 'Product_C']
print(difflib.get_close_matches(df['col1'], products_list))
However I'm getting always a empty list...
What I am doing wrong?
Thanks!