我的数据存储为两个整数数组的数组。每个内部数组代表一行。共有828个“列”(或内部数组中的项)
我想对具有2个组件的数据执行PCA。即使这不是我的数据,我也希望得到这样的输出: 在上面,尽管列现在是主要成分1和2,但行数保持不变。
这是我的代码:
pca = PCA(n_components=2)
principalComponents = pca.fit(wc_accounts)
data = pca.components_
principalDf = pd.DataFrame(data , index = ['principal component 1', 'principal component 2']).T
不幸的是,principalDf包含828行和2列-而我希望它包含2行和2列。我认为它在每列与行上都执行PCA吗?