擅长:python、mysql、java
<p>numpy将数组内的False求值为0:</p>
<pre><code> >>>np.array([False,True,2,3])
array([0, 1, 2, 3])
</code></pre>
<p>所以这可能不是你想要的。在</p>
^{pr2}$
<p>在纽比。在哪里函数用索引构建一个数组,其中您的项是NaN。在那里,它用replace_nunan替换条目,在其他任何地方它都保留条目。在</p>
<p>从<a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html" rel="nofollow">manual page</a>:</p>
<pre><code>numpy.where(condition[, x, y])
Return elements, either from x or y, depending on condition.
</code></pre>