 <p>Assuming my understanding is correct you just need to:</p> <pre><code>numpy.logical_and.reduce(features[index] == features) </code></pre> <p>Here we first produce the matches between all rows and <code>feature[index]</code> with:</p> <pre><code>features[index] == features </code></pre> <p>Then, we reduce the matrix, which effectively tests, for a column <code>j</code>, if <code>features[index][j] == features[j]</code> for all <code>i</code> </p> <p>As an example:</p> <pre><code>&gt;&gt;&gt; features = numpy.asarray(numpy.random.randint(2, size=(5, 10)), dtype=bool) &gt;&gt;&gt; features array([[False, True, True, True, False, False, True, False, False, False], [ True, False, True, True, True, True, True, True, False, True], [ True, False, True, False, False, True, True, True, True, True], [False, False, True, False, True, False, False, True, False, True], [False, True, True, True, False, True, False, True, True, True]], dtype=bool) &gt;&gt;&gt; numpy.logical_and.reduce(features[3] == features) array([False, False, True, False, False, False, False, False, False, False]) </code></pre>