I have a dataframe, which contains info about movies. It has a column called
genre, which contains a list of genres it belongs to. For example
df['genre'] ## returns 0 ['comedy', 'sci-fi'] 1 ['action', 'romance', 'comedy'] 2 ['documentary'] 3 ['crime','horror'] ...
I want to know how can I query the df, so it returns the movie belongs to a cerain genre?
For example, something may like
df['genre'].contains('comedy') returns 0, 1.
I know for a list, I can do things like
'comedy' in ['comedy', 'sci-fi']
but in pandas, I didn't find something similar, the only thing I know is
df['genre'].str.contains(), but it didn't work for the list type.