I am trying to do a very simple iteration in a Numpy 2D array in which I compare neighbor elements by row and then by column for equality. This is working fine as below: