performPca = py`
import pandas as pd
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
def perform_pca(data, n_components):
df = pd.DataFrame(data)
X = StandardScaler().fit_transform(df)
pca = PCA(n_components=n_components)
data = pca.fit_transform(X)
return { "result": pca, "data": data }
perform_pca
`