title: Replacing -inf values to np.nan in a feature pandas.series
body: <p>I want to replace the -inf values in a pandas.series feature (column of my dataframe) to np.nan, but I could not make it. </p>
  
  <p>I have tried: </p>
  
  <pre><code>    df[feature] = df[feature].replace(-np.infty, np.nan)
      df[feature] = df[feature].replace(-np.inf, np.nan)
      df[feature] = df[feature].replace('-inf', np.nan)
      df[feature] = df[feature].replace(float('-inf'), np.nan)
  </code></pre>
  
  <p>But it does not work. Any ideas how to replace these values?</p>
  
  <p>Edit: </p>
  
  <pre><code>df[feature] =  df[feature].replace(-np.inf, np.nan)
  </code></pre>
  
  <p>works</p>
  
  <p>BUT:</p>
  
  <pre><code>df =  df.replace(-np.inf, np.nan)
  </code></pre>
  
  <p>does not work. </p>