Answers for "apply pca to dataframe"

C++
0

apply pca to dataframe

import pandas as pd
import numpy as np
from sklearn.decomposition import PCA

df = pd.DataFrame(data=np.random.normal(0, 1, (20, 10)))

pca = PCA(n_components=5)
pca.fit(df)
Posted by: Guest on June-13-2021

Browse Popular Code Answers by Language