def drop_first_component(X, y):
 pipeline = make_pipeline(PCA(), FunctionTransformer(all_but_first_column))
 (X_train, X_test, y_train, y_test) = train_test_split(X, y)
 pipeline.fit(X_train, y_train)
 return (pipeline.transform(X_test), y_test)

def drop_first_component ( X , y ) : pipeline = make_pipeline ( PCA ( ) , FunctionTransformer ( all_but_first_column ) ) ( X_train , X_test , y_train , y_test ) = train_test_split ( X , y ) pipeline . fit ( X_train , y_train ) return ( pipeline . transform ( X_test ) , y_test )
create a pipeline with pca and the column selector and use it to transform the dataset .