title: Pandas style.bar color based on condition?
body: <p>How can I render a Pandas df where one of the columns' <code>style.bar.color</code> property is computed based on some condition?</p>
  
  <p>Example:</p>
  
  <pre><code>df.style.bar(subset=['before', 'after'], color='#ff781c', vmin=0.0, vmax=1.0)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/EPrDO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EPrDO.png" alt="enter image description here"></a></p>
  
  <p>Instead of having both columns highlight with <code>#ff781c</code>, I'd like one of the columns (<code>df['before']</code>) to remain that same constant color, and the other column (<code>df['after']</code>) to be computed as:</p>
  
  <pre><code>def compute_color(row):
     if row['after'] &gt;= row['before']:
        return 'red'
     else:
        return 'green
  </code></pre>