title: Python: the pandas dataframe function keep thinking the same dataframe has different dimensions
body: <p>I have a 2D dataframe and there are some NaN's, so I am using an Imputer function to help me fill those missing values. </p>
  
  <p>When I print:</p>
  
  <pre><code>print 'size of X: ', X.shape
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>size of X:  (3373, 36)
  </code></pre>
  
  <p>So it shows that my data frame is 3373 rows by 36 columns. </p>
  
  <p>However, when I try to fit this into the Imputer function right after above print statment:</p>
  
  <pre><code>imp = Imputer(missing_values="NaN", strategy='mean', axis=0)
  X = pd.DataFrame(imp.fit_transform(X), columns=X.columns)
  </code></pre>
  
  <p>I keep getting the Errors:</p>
  
  <pre><code>ValueError: Shape of passed values is (35, 3373), indices imply (36, 3373)
  </code></pre>
  
  <p>How is the shape passed values become (35, 3373) when I have checked that it is indeed (36, 3373)? What happened here?</p>
  
  <p>I searched up the Error on Google but other posts do not have same problem as I do, so I couldn't find much help online myself...</p>
  
  <p>I am quite new to Python, and would greatly appreciate any help!</p>
  
  <p><strong>Note</strong>:</p>
  
  <p>the dtypes for X before transformation looks like:</p>
  
  <pre><code>X dtype: 
      Material                   int64
      Plant                      int64
      Material Type              int64
      ...
      MRP group                  int64
      Reorder Point            float64
      dtype: object
  </code></pre>
  
  <p>When I used following code to check if any column is completely null, I didn't get anything printed out. so that should mean I do not have any empty columns in my X, right?</p>
  
  <pre><code>for col in X.columns.values:
      if X.ix[:, col].empty:
          print col
  </code></pre>