title: using Simple Imputer with Pandas dataframe?
body: <p>I am working with the following dataset:</p>
  
  <p><a href="https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data" rel="nofollow noreferrer">https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data</a></p>
  
  <p>which it says that has some missing values marked with "?". I want to apply the SimpleImputer library and my code is the following:</p>
  
  <pre><code>file="breast_cancer"
  df=pd.read_csv(file,names=['id', 'clump_thickness','unif_cell_size',
                                                           'unif_cell_shape', 'marg_adhesion', 'single_epith_cell_size',
                                                           'bare_nuclei', 'bland_chromatin', 'normal_nucleoli','mitoses','class'])
  df.replace('?',np.NaN,inplace=True)
  imp=SimpleImputer(missing_values="NaN")
  idf=pd.DataFrame(imp.fit_transform(df))
  idf.columns=df.columns
  idf.index=df.index
  </code></pre>
  
  <p>so I want to replace all the ? values from all the columns with the mean, and return a new dataframe. The problem is that I got the following error:</p>
  
  <pre><code>Input contains NaN, infinity or a value too large for dtype('float64').
  </code></pre>
  
  <p>What am I missing?</p>
  
  <p>Thanks</p>