lundi 29 juillet 2019

Control for matching parts of a string (with one or multiple words)

I'm looking for a method to flag rows in which a string, or parts of the string (which may have two words) in a DataFrame column A, appear in another column B.

Example data with desired outcome in column C:

A               B                                C
Looney Tunes    Better than the Looney Tunes     True
Looney Tunes    Show me some tunes               True
Deep Tech       New tech is here                 True
Deeptech        Deeptech is here                 True
Car Ambolage    Camambolage happened             True
Something       Some thing is here               True          
Something else  This does not relate             False
Space           I am in universe                 False

What is the best approach?

Aucun commentaire:

Enregistrer un commentaire