lundi 7 décembre 2015

Comparing boolean numpy arrays

I have two boolean numpy arrays of similar shape like:

a=[[True,True,False,False]]
b=[[True,False,True,False]]

How can I get an array c where 1 indicates that only array a is true, 2 indicates that only array b is true, 0 where both arrays are false and nan where both are true. So in this case the result should be [[nan,1,2,0]]].

Aucun commentaire:

Enregistrer un commentaire