Suppose I have the following numpy array:
a = [[1, 5, 6], [2, 4, 1], [3, 1, 5]]
I want to mask all the rows which have 1
1
You can create the desired mask by
mask = numpy.repeat(a[:,0]==1, a.shape[1])
and the masked array by
masked_a = numpy.ma.array(a, mask=numpy.repeat(a[:,0]==1, a.shape[1]))