def _transform_selected(X, transform, selected="all", copy=True):
    if isinstance(selected, six.string_types) and selected == "all":
        return transform(X)

    X = check_array(X, accept_sparse='csc', copy=copy, dtype=FLOAT_DTYPES)

    if len(selected) == 0:
        return X

    n_features = X.shape[1]
    ind = np.arange(n_features)
    sel = np.zeros(n_features, dtype=bool)
    sel[np.asarray(selected)] = True
    not_sel = np.logical_not(sel)
    n_selected = np.sum(sel)

    if n_selected == 0:
        # No features selected.
        return X
    elif n_selected == n_features:
        # All features selected.
        return transform(X)
    else:
        X_sel = transform(X[:, ind[sel]])
        X_not_sel = X[:, ind[not_sel]]

        if sparse.issparse(X_sel) or sparse.issparse(X_not_sel):
            return sparse.hstack((X_sel, X_not_sel))
        else:
            return np.hstack((X_sel, X_not_sel))
Initialize the Factory.
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/preprocessing/data.py/_transform_selected--crossover with--dataset/ETHPy150Open rapyuta/rce/rce-comm/rce/comm/server.py/CloudEngineWebSocketFactory.__init__