I am trying to add a column to the dataframe below, that would tell me if a person belongs to the category Green or not. It would just show Y or N, depending on whether the column category contains it, for that person. The problem is that the column category contains in some lines just a string, and in other a list of strings and even on others a list of lists.
import pandas as pd
df = pd.DataFrame({'user': ['Bob', 'Jane','Theresa', 'Alice'],
'category': [[['green'],['red']],'blue',['green'],[['yellow','purple'],'green','brown']]})
How can I make it so that I get to see if the column, for each row, contains the specific 'Green' string?
Thank you.