Reputation: 625
Any example where I can get two strings in a column of a dataframe when ratio condition met?
Example - While comparing one string with column of a dataframe, it should return only those when SequenceMatcher.ratio() > 0.8.
Upvotes: 1
Views: 64
Reputation: 863611
IIUC use boolean indexing
with filter by lambda function in Series.apply
:
text = 'my text'
df1 = df[df['col'].apply(lambda x: SequenceMatcher(None, x, text).ratio()) > 0.8]
Upvotes: 1