Filter Multi-Dimensional Array
<p>I have an array (lists) which is NxK. However, I want to "filter" is after inputting some constraints based on values in Columns 4 and 6. This is the code I have so far.</p>

<pre><code>minmag = 5
maxmag = 7

mindist = 25
maxdist = 64

filter = np.zeros((1, 7), dtype='object')
add = np.zeros((1, 7), dtype='object')
k = 0

for i in range(0,len(lists)):
    if lists[i, 4]&gt;= minmag and lists [i, 4] &lt;= maxmag and lists [i, 6]&gt;=mindist and  lists [i, 6]&lt;= maxdist:
        if k == 0:
            for x in range(0,16):
                filter[0, x] = lists[i, x]
            k = 1
        else:
            for x in range(0, 16):
                add[0, x] = lists[i, x]
            filter = np.append(filter, add, axis=0)
</code></pre>

<p>It works, however it is not so neat. Just wondering if anyone has a better solution.</p>