I have a dataset with 23 rows and 48 columns. I am applying PCA to reduce the number of column dimensions. I use the following codes examples and I see that only 23 are required features:
#first
import numpy as np
from sklearn.decomposition import PCA
pca = PCA().fit(only_features)
plt.figure(figsize=(15,8))
plt.plot(np.cumsum(pca.explained_variance_ratio_))
plt.xlabel('number of components')
plt.ylabel('cumulative explained variance')
#second
df_pca = pca.fit_transform(X=only_features)
df_pca = pd.DataFrame(df_pca)
print(df_pca.shape)
However, I would want to know which are the features required. Like for example: If the original dataset had columns A-z and reduced by PCA, then I would want to know which are the features selected.
How to do that?
Thanks for help