How to match a word from column and compare with other column in pandas dataframe
I have the below dataframe
Text Keywords Type
It’s a roll-on tube roll-on ball
It is barrel barrel barr
An unknown shape others
it’s a assembly assembly assembly
it’s a sealing assembly assembly factory
its a roll-on double roll-on factory
I have first found out the keywords, and based on the keyword and its corresponding type, it should true or false
For example, when the keyword is roll-on , the type should be "ball" or "others" when the keyword is barrel, the type should be "barr" or "others"
Output
Text Keywords Type Result
It’s a roll-on tube roll-on ball True
It is barrel barrel barr True
An unknown shape others False
it’s a assembly assembly assembly True
it’s a sealing assembly assembly factory True
its a roll-on double roll-on factory False
Topic dataframe text pandas python
Category Data Science