def _dense_transform(self, X, valid_stats, valid_idx):
        mask = _get_mask(X, self.missing_values)
        n_missing = np.sum(mask, axis=self.axis)
        values = np.repeat(valid_stats, n_missing)

        if self.axis == 0:
            coordinates = np.where(mask.transpose())[::-1]
        else:
            coordinates = mask

        X[coordinates] = values

        features_with_missing_values = np.where(np.any
                                                (mask, axis=0))[0]
        imputed_mask = mask[:, features_with_missing_values]
        if self.axis == 0:
            self.imputed_features_ = valid_idx[features_with_missing_values]
        else:
            self.imputed_features_ = features_with_missing_values

        if self.add_indicator_features:
            X = np.hstack((X, imputed_mask))

        return X
transformer on dense data.
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/preprocessing/imputation.py/Imputer._dense_transform