Assuming
import numpy
a = numpy.array([[0, 1, 2, 3, 1],
[0, 2, 2, 1, 0],
[0, 4, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 4, 5]])
then
b = a == a[0,:] # compares first row with all others using broadcasting
# b: array([[ True, True, True, True, True],
# [ True, False, True, False, False],
# [ True, False, True, True, False],
# [ True, True, True, True, False],
# [ True, True, True, False, False]], dtype=bool)
using all along the rows acts as a row-wise and operation (thanks Divakar!):
c = b.all(axis=0)
# c: array([ True, False, True, False, False], dtype=bool)
which you can use for boolean indexing
a[:, ~c]
Out:
array([[1, 3, 1],
[2, 1, 0],
[4, 3, 4],
[1, 3, 4],
[1, 4, 5]])
As an ugly oneliner:
a[:, ~(a == a[0,:]).all(0)]