title: Pandas: Getting 0s and the NaNs when Normalizing Data
body: <p>I'm having some trouble normalizing my data in Pandas.  I've created a model and am trying to use it to predict.</p>
  
  <p>First, I have this:</p>
  
  <pre><code>_text_img_count  _text_vid_count  _text_link_count  _text_par_count  ...
  0                2                0                 6
  </code></pre>
  
  <p>Then I normalize as follows:</p>
  
  <pre><code>    x = numeric_df.values #returns a numpy array
      min_max_scaler = preprocessing.MinMaxScaler()
      x_scaled = min_max_scaler.fit_transform(x)
      numeric_df_normalized = pd.DataFrame(x_scaled)
  </code></pre>
  
  <p>Now, <code>numeric_df_normalized</code> looks like this:</p>
  
  <pre><code> 0    1    2    3    4    5    6    7    8    9  ...    13   14   15   16  \
  0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0 ...   0.0  0.0  0.0  0.0   
  
      17   18   19   20   21   22  
  0  0.0  0.0  0.0  0.0  0.0  0.0  
  </code></pre>
  
  <p>So I've lost my column names and my values are all 0.</p>
  
  <p>Finally, I try to add back the old column names from the original <code>numeric_df</code> as follows:</p>
  
  <pre><code>numeric_df_normalized = pd.DataFrame(numeric_df_normalized, columns=numeric_df.columns)
  </code></pre>
  
  <p>I get back:</p>
  
  <pre><code>_text_img_count  _text_vid_count  _text_link_count ...
              NaN              NaN               NaN
  </code></pre>
  
  <p>So a few questions:</p>
  
  <p>1) Why does normalization cause me to lose my column names and set them to 0?</p>
  
  <p>2) Why does adding back the column names from <code>numeric_df</code> cause my 0s to be converted to NaNs?</p>
  
  <p>Thanks!</p>