title: I have problems to replace inf and -inf win nan in pandas
body: <p>I found a code on the web to replace <code>inf</code> and <code>-inf</code> with <code>np.nan</code>, however it did not work on my computer.</p>
  <pre><code>df = pd.DataFrame({&quot;A&quot; : [4.6, 5., np.inf]})
  new_dataframe = a_dataframe.replace([np.inf, -np.inf], np.nan)
  df
  </code></pre>
  <p>My output</p>
  <pre><code>    A
  0   4.6
  1   5.0
  2   inf
  </code></pre>
  <p>Does somebody know a solution?</p>