def pca_pipe(data, n):
    from sklearn.preprocessing import StandardScaler
    from sklearn.decomposition import PCA
    from sklearn.pipeline import Pipeline
    pca = PCA(n)
    pipe = Pipeline([('scalar', StandardScaler()), ('pca', pca)])
    PCs = pipe.fit_transform(data)
    return PCs, pca.explained_variance_ratio_

091804141080a3fbc1d9f57806818b1fdbf369c3
<mask token>

def pca_pipe(data, n):
    from sklearn.preprocessing import StandardScaler
    from sklearn.decomposition import PCA
    from sklearn.pipeline import Pipeline
    pca = PCA(n)
    pipe = Pipeline([('scalar', StandardScaler()), ('pca', pca)])
    PCs = pipe.fit_transform(data)
    return PCs, pca.explained_variance_ratio_
