title: How to replace inf in a numpy array with zero
body: <p>I am trying to eliminate an inf from a pandas DataFrame, caused by a division by zero. I have tried several techniques using both DataFrame and ndarray structures:</p>
  
  <pre><code>df_fund['dly_retn'].replace(np.inf, 0)
  na_fund['dly_retn'].replace(np.inf, 0)
  na_dly_retn(~isfinite(na_dly_retn))=0
  </code></pre>
  
  <p>Taking the mean in every case results in <code>"inf"</code></p>
  
  <p>I have searched for two days without finding an answer to what should be a trivial problem.</p>