擅长:python、mysql、java
<p>如果要寻找矢量化解决方案,请查看以下内容。考虑列名称的更改可能与您的</P>不同。
<pre><code> Date time deliver status
0 2020-03-27 16:15:00 Receive-Deliver EXPIRE_TO_CLOSE
1 2020-03-31 17:00:00 Receive-Deliver BUY_TO_OPEN
2 2020-03-31 17:00:00 Receive-Deliver EXPIRE_TO_CLOSE
3 2020-04-01 11:00:05 Trade SELL_TO_CLOSE
4 2020-04-01 11:00:05 Trade SELL_TO_CLOSE
</code></pre>
<p>涂口罩</p>
<pre><code>m=df.status.str.contains(r'TO_OPEN')
m
</code></pre>
<p>填充栏</p>
<pre><code>df.loc[m,'availability']='open'
df
</code></pre>
<p>结果</p>
<p><a href="https://i.stack.imgur.com/9vJtn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9vJtn.png" alt="enter image description here"/></a></p>