In some part of my Python program I have a val variable that can be 1 or 0. If it\'s 1 I must change to 0, if it\'s 0 I must change to 1.
How do you do it in a Pytho
use np.where
ex.
np.where(np.array(val)==0,1,0)
this gives 1 where val is 0 and gives 0 where val is anything else, in your case 1
EDIT: val has to be array