I'm new in python, so.... I have a dataframe like this:
id city name text
1 Boston Rosie I have some text here, as you can see.
2 New York Liza I love my cat
So I'l like to search inside each row the text and have some result like:
I rearch in the text "love" or "love" && "cat" and I want return the city or the name.
I tried the follow code:
if df[df['text'].str.contains("love") | df['text'].str.contains("cat")]:
print(df['name'])
It's throwing an error of the form "The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()."