title: Pandas- Dividing a column by another column conditional on if values are greater than 0?
body: <p>I have a pandas dataframe that contains dates, items, and 2 values. All I'm looking to do is output another column that is the product of column A / column B if column B is greater than 0, and 0 if column B is equal to 0. </p>
  
  <pre><code>   date     item   A   B        C       
   1/1/2017   a      0   3             0  
   1/1/2017   b      2   0             0  
   1/1/2017   c      5   2           2.5  
   1/1/2017   d      4   1             4  
   1/1/2017   e      3   3             1  
   1/1/2017   f      0   4             0  
   1/2/2017   a      3   3             1  
   1/2/2017   b      2   2             1  
   1/2/2017   c      3   9   0.333333333  
   1/2/2017   d      4   0             0  
   1/2/2017   e      5   3   1.666666667  
   1/2/2017   f      3   0             0  
  </code></pre>
  
  <p>this is the code I've written, but the kernel keeps dying (keep in mind this is just an example table, I have about 30,000 rows so nothing too crazy)</p>
  
  <pre><code>df['C'] = df.loc[df['B'] &gt; 0, 'A'] / df['B'])
  </code></pre>
  
  <p>any idea on what's going on? Is something running infinitely that's causing it to crash? Thanks for the help. </p>