回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我将Python与<code>numpy</code>一起使用。你知道吗</p>
<p>我有numpy数组<code>b</code>:</p>
<pre><code> b = np.array([True,True,True,False,False,True,True,False,False,False,True,False,True])
</code></pre>
<p>我需要分别替换数组<code>[True]</code>和<code>[True,True]</code>上的<code>[False]</code>和<code>[False,False]</code>。
(我需要排除<code>False</code>中数组的单saltuse和双saltuse)</p>
<p>对于此示例:</p>
<pre><code>out= np.array([True,True,True,True, True, True,True,False,False,False,True,True,True])
</code></pre>
<p>有人能建议我怎样得到<code>out</code>?</strong></p>
<p><strong>p.S:</strong>如果我需要分别替换数组<code>[False]</code>、<code>[False,False]</code>、<code>[False,False,False]</code>和<code>[False,False,False,False]</code>上的<code>[True]</code>、<code>[True,True]</code>、<code>[True,True,True]</code>和<code>[True,True,True,True]</code>?你知道吗</p>