擅长:python、mysql、java
<p>您可以使用<code>np.where</code>:</p>
<pre><code>more_than = ... # value of new column when more
less_than = ... # value of new column when less
mydf['newcol'] = np.where(mydf['myopen'] > mydf['myclose'], more_than, less_than)
</code></pre>