title: handling zeros in pandas DataFrames column divisions in Python
body: <p>What's the best way to handle zero denominators when dividing pandas DataFrame columns by each other in Python? for example:</p>
  
  <pre><code>df = pandas.DataFrame({"a": [1, 2, 0, 1, 5], "b": [0, 10, 20, 30, 50]})
  df.a / df.b  # yields error
  </code></pre>
  
  <p>I'd like the ratios where the denominator is zero to be registered as NA (<code>numpy.nan</code>). How can this be done efficiently in pandas? </p>
  
  <p>Casting to <code>float64</code> does not work at level of columns:</p>
  
  <pre><code>In [29]: df
  Out[29]: 
     a   b
  0  1   0
  1  2  10
  2  0  20
  3  1  30
  4  5  50
  
  In [30]: df["a"].astype("float64") / df["b"].astype("float64")
  ...
  
  FloatingPointError: divide by zero encountered in divide
  </code></pre>
  
  <p>How can I do it just for particular columns and not entire df?</p>