'Forward and inverse transform.
Parameters
X : ndarray, shape (n_samples, n_features)
The data used to scale along the features axis.
inverse : bool, optional (default=False)
If False, apply forward transform. If True, apply
inverse transform.
Returns
X : ndarray, shape (n_samples, n_features)
Projected data'

def _transform(self, X, inverse=False):

    if sparse.issparse(X):
        for feature_idx in range(X.shape[1]):
            column_slice = slice(X.indptr[feature_idx], X.indptr[(feature_idx + 1)])
            X.data[column_slice] = self._transform_col(X.data[column_slice], self.quantiles_[:, feature_idx], inverse)
    else:
        for feature_idx in range(X.shape[1]):
            X[:, feature_idx] = self._transform_col(X[:, feature_idx], self.quantiles_[:, feature_idx], inverse)
    return X
