np.logical_and(np.bitwise_or.reduce(b) == b[0], np.bitwise_and.reduce(b) ==
    b[0])
np.logical_and(np.bitwise_or.reduce(c) == c[0], np.bitwise_and.reduce(c) ==
    c[0])
How to check if all values in the columns of a numpy matrix are the same?