title: Pandas apply but only for rows where a condition is met
body: <p>I would like to use Pandas <code>df.apply</code> but only for certain rows</p>
  
  <p>As an example, I want to do something like this, but my actual issue is a little more complicated:</p>
  
  <pre><code>import pandas as pd
  import math
  z = pd.DataFrame({'a':[4.0,5.0,6.0,7.0,8.0],'b':[6.0,0,5.0,0,1.0]})
  z.where(z['b'] != 0, z['a'] / z['b'].apply(lambda l: math.log(l)), 0)
  </code></pre>
  
  <p>What I want in this example is the value in 'a' divided by the log of the value in 'b' for each row, and for rows where 'b' is 0, I simply want to return 0.</p>