How can I add/create a column which returns a 1, if the value in the column contains < or << and 0 if it does not, based on a column df['value']?
df['INDICATOR'] = [1 if x.str.contains("<|<<") else 0 for x in df['value']]
My attempt above returns an attributeError: 'str object has no attrbute 'str'
Aucun commentaire:
Enregistrer un commentaire