I have a dataframe df
like this:
A B C D
1 blue red square NaN
2 orange yellow circle NaN
3 black grey circle NaN
and I want to update column D when it meets 3 conditions. Ex:
df.ix[ np.logical_and(df.A=='blue', df.B=='red', df.C=='square'), ['D'] ] = 'succeed'
It works for the first two conditions, but it doesn't work for the third, thus:
df.ix[ np.logical_and(df.A=='blue', df.B=='red', df.C=='triangle'), ['D'] ] = 'succeed'
has exactly the same result:
A B C D
1 blue red square succeed
2 orange yellow circle NaN
3 black grey circle NaN