title: pca.fit(X) return Error ValueError: setting an array element with a sequence
body: <p>guys.. I'm on some project that involve image data reduction.</p>
  
  <p>And i'm suppose to use this the load the data. I'm already import the needed lib.</p>
  
  <pre><code>faces = pd.DataFrame([])
  for file in os.listdir('dataset/'):
      file_name, file_extension = os.path.splitext(file)
      if(file_extension in ['.pgm']):
  
          img = cv2.imread('dataset/'+ '/' + file)
          face = pd.Series(img.flatten(),name=file)
          faces = faces.append(face.fillna(0))
  </code></pre>
  
  <p>And right after I populate the data, I do data-splitting for train and test. like this.</p>
  
  <pre><code>X = []
  y = []
  for nameFolder in os.listdir('dataset/LEFT'):
      for file in os.listdir('dataset/LEFT/' + nameFolder):
          img = cv2.imread('dataset/LEFT/' + nameFolder + '/' + file )
          face = pd.Series(img.flatten(),name=file)
          X.append(face)
          y.append(nameFolder)
  </code></pre>
  
  <p>all that code above, still working fine. but the problem happen after that.
  I want to used for <code>scaler</code> or <code>PCA</code>, but it give me some Error.</p>
  
  <p>the rest below is about how i do my data-split, PCA, and scaler.</p>
  
  <pre><code>from sklearn.model_selection import train_test_split
  X_train, X_test, train_label, test_label = train_test_split( X, y, test_size=0.4, random_state=0)
  </code></pre>
  
  <p>Scaler:</p>
  
  <pre><code>from sklearn.preprocessing import StandardScaler
  scaler = StandardScaler()
  scaler.fit(X_train)
  train_img = scaler.transform(X_train)
  test_img = scaler.transform(test_img)
  </code></pre>
  
  <p>PCA:</p>
  
  <pre><code>from sklearn.decomposition import PCA
  faces_pca = PCA(n_components=2)
  faces_pca.fit(X)
  components = faces_pca.transform(X)
  projected = faces_pca.inverse_transform(components)
  </code></pre>
  
  <p>and the error below shown, right on I'm using .fit():</p>
  
  <pre><code>ValueError: setting an array element with a sequence.
  </code></pre>
  
  <p>So now, I want asking. must I need change the data format or type or something? if yes, tell me must be like that, and how to be like that if possible. and next
  If my data was ok, what i must do before, to make it possible to do some .fit() and finish the data using PCA or scaler.</p>