Pandas: Ternary conditional operator for setting a value in a DataFrame : <p>I have a dataframe <code>pd</code>. I would like to change a value of column <code>irr</code> depending on whether it is above or below a thresh hold.</p>

<p>How can  I do this in a single line? Now I have </p>

<pre><code>pd['irr'] = pd['irr'][pd['cs']*0.63 &gt; pd['irr']] = 1.0
pd['irr'] = pd['irr'][pd['cs']*0.63 &lt;=  pd['irr']] = 0.0
</code></pre>

<p>The problem of course is that I change <code>irr</code> and check it again in the next line.</p>

<p>Is there something like a ternary conditional operator for pandas?</p>
