title: Python ValueError: non-broadcastable output operand with shape (124,1) doesn't match the broadcast shape (124,13)
body: <p>I would like to normalize a training and test data set using <code>MinMaxScaler</code> in <code>sklearn.preprocessing</code>. However, the package does not appear to be accepting my test data set.</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  # Read in data.
  df_wine = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data', 
                        header=None)
  df_wine.columns = ['Class label', 'Alcohol', 'Malic acid', 'Ash',
                     'Alcalinity of ash', 'Magnesium', 'Total phenols',
                     'Flavanoids', 'Nonflavanoid phenols', 'Proanthocyanins',
                     'Color intensity', 'Hue', 'OD280/OD315 of diluted wines',
                     'Proline']
  
  # Split into train/test data.
  from sklearn.model_selection import train_test_split
  X = df_wine.iloc[:, 1:].values
  y = df_wine.iloc[:, 0].values
  X_train, y_train, X_test, y_test = train_test_split(X, y, test_size=0.3, 
                                                      random_state = 0)
  
  # Normalize features using min-max scaling.
  from sklearn.preprocessing import MinMaxScaler
  mms = MinMaxScaler()
  X_train_norm = mms.fit_transform(X_train)
  X_test_norm = mms.transform(X_test)
  </code></pre>
  
  <p>When executing this, I get a <code>DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.</code> along with a <code>ValueError: operands could not be broadcast together with shapes (124,) (13,) (124,)</code>.</p>
  
  <p>Reshaping the data still yields an error.</p>
  
  <pre><code>X_test_norm = mms.transform(X_test.reshape(-1, 1))
  </code></pre>
  
  <p>This reshaping yields an error <code>ValueError: non-broadcastable output operand with shape (124,1) doesn't match the broadcast shape (124,13)</code>.</p>
  
  <p>Any input on how to get fix this error would be helpful. </p>