Suppose I have the following dataframe
df = pd.DataFrame({'col1': ['one','one', 'one', 'one', 'two'],
'col2': ['two','two','four','four','two'],
'col3': [['alpha', 'beta'],
['alpha', 'beta'],
['alpha', 'beta'],
['alpha', 'beta'],
['alpha', 'nodata', 'beta', 'gamma']]})
I know I can subset with:
df[df['col2']=='four']
How do I subset so that it matches a string INSIDE of a list? in this example, subset the rows that don't contain 'nodata' in col3?
df[~df['col3'].str.contains('nodata')
doesn't seem to work and I can't properly seem to access the 'right' item inside of the list.