擅长:python、mysql、java
<p>要从numpy表中删除第二行:</p>
<pre><code>import numpy
n = numpy.array([[1,2],[0,0],[5,6]])
new_n = numpy.delete(n, 1, axis=0)
</code></pre>
<p>要删除仅包含0的行:</p>
<pre><code>import numpy
n = numpy.array([[1,2],[0,0],[5,6]])
idxs = numpy.any(n != 0, axis=1) # index of rows with at least one non zero value
n_non_zero = n[idxs, :] # selection of the wanted rows
</code></pre>