from pca import pca
X = [[1,2],
[2,1],
[3,3]]
p = pca(n_components=2,normalize=True)
p.fit_transform(X)
328 if verbose>=3: print('[pca] >n_components is set to %d' %(self.n_components))
329
--> 330 self.n_feat = np.min([self.n_feat, X.shape[1]])
331
332 if (not self.onehot) and (not self.normalize) and isinstance(X, pd.DataFrame) and (str(X.values.dtype)=='bool'):
AttributeError: 'list' object has no attribute 'shape'
Can we check X's type and convert it to np.ndarray if it is a list?
The following case will throw an AttributeError:
Can we check X's type and convert it to np.ndarray if it is a list?