0

I'm referring to this document https://datatofish.com/if-condition-in-pandas-dataframe/

The part - (3) IF condition - strings

I'm trying to implement it with 2 conditions as:

x.loc[x.Test Status == 'Finished' and x.Results Validation == 'In Limits', 'Outcome'] = 'PASS'

I've a invalid syntax error. How do I handle this? I've tried multiple workarounds like np.where but no luck.

srkdb
  • 775
  • 3
  • 15
  • 28
  • 1
    Go down to section 5. The syntax is `(x['Test Status'] == 'Finished') & (x['Results Validation'] == 'In Limits')`. Notice you cannot use `.` to access columns when the column name has a space in it. – ALollz Apr 30 '19 at 20:27
  • `x.loc[(x.Test Status == 'Finished' )&(x.Results Validation == 'In Limits'), 'Outcome']` – BENY Apr 30 '19 at 20:27
  • @Wen-Ben: I tried that. It doesn't work. – srkdb Apr 30 '19 at 21:03
  • 1
    x.loc[(x['Test Status'] == 'Finished' )&(x['Results Validation'] == 'In Limits'), 'Outcome'] – BENY Apr 30 '19 at 21:07

0 Answers0