Convert Numpy array with 'n' and 'y' into integer array of 0 and 1
It is quite trivial

(X=='y').astype(int)


Should do the trick. It simply converts your array to True or False according to your requirements and then astype will impose the required datatype. By default int will give you 1 for True and 0 for False.