1

I have a pandas DF and am looking to test if a column contains a certain string in the cell.

I used list comprehension to create a list of values from df["Situation"] that had "Standalone" in the value.

I wanted to test membership against this list, and if the value existed here then return FALSE .

`df['Standalone'] = df.apply(lambda x: x == 'FALSE' if ['Situation'] not in 
true_std_list else 'TRUE', axis=1)`

Pandas throws an error re; series ambiguous.

any ideas?

randyslavage
  • 65
  • 1
  • 5

0 Answers0