You can use apply
for create mask
and then boolean indexing
:
mask = df.genre.apply(lambda x: 'comedy' in x)
df1 = df[mask]
print (df1)
genre
0 [comedy, sci-fi]
1 [action, romance, comedy]
More Related Contents:
- How to provide a reproducible copy of your DataFrame with to_clipboard()
- Combine two columns of text in pandas dataframe
- How to apply a function to two columns of Pandas dataframe
- Dynamically evaluate an expression from a formula in Pandas
- How to get rid of “Unnamed: 0” column in a pandas DataFrame read in from CSV file?
- Load data from txt with pandas
- Add Leading Zeros to Strings in Pandas Dataframe
- Pandas convert dataframe to array of tuples
- Coloring Cells in Pandas
- How to import data from mongodb to pandas?
- How to group a pandas dataframe by a defined time interval?
- How to sort a Pandas DataFrame by index?
- custom matplotlib plot : chess board like table with colored cells
- Adding calculated column(s) to a dataframe in pandas
- How do you plot a vertical line on a time series plot in Pandas?
- pandas applying regex to replace values
- why does pandas rolling use single dimension ndarray
- pandas two dataframe cross join [duplicate]
- Bin pandas dataframe by every X rows
- module ‘pandas’ has no attribute ‘rolling_mean’
- Convert dataframe index to datetime
- Python: Removing Rows on Count condition
- Get first row of dataframe in Python Pandas based on criteria
- How to specify the type of pandas series elements in type hints?
- how to save a pandas DataFrame to an excel file?
- Excel VLOOKUP equivalent in pandas
- How to efficiently assign unique ID to individuals with multiple entries based on name in very large df
- Add image annotations to bar plots
- Seaborn multiple barplots
- Add density curve on the histogram