(
            self,
            X,
            missing_mask,
            fill_method=None,
            inplace=False)
return X
Parameters
        ----------
        X : np.array
            Data array containing NaN entries

        missing_mask : np.array
            Boolean array indicating where NaN entries are

        fill_method : str
            "zero": fill missing entries with zeros
            "mean": fill with column means
            "median" : fill with column medians
            "min": fill with min value per column
            "random": fill with gaussian samples according to mean/std of column

        inplace : bool
            Modify matrix or fill a copy
Parameters
        ----------
        X : np.array
            Data array containing NaN entries
Parameters ---------- X : np . array Data array containing NaN entries
def fill(
            self,
            X,
            missing_mask,
            fill_method=None,
            inplace=False):
        """
        Parameters
        ----------
        X : np.array
            Data array containing NaN entries

        missing_mask : np.array
            Boolean array indicating where NaN entries are

        fill_method : str
            "zero": fill missing entries with zeros
            "mean": fill with column means
            "median" : fill with column medians
            "min": fill with min value per column
            "random": fill with gaussian samples according to mean/std of column

        inplace : bool
            Modify matrix or fill a copy
        """
        X = check_array(X, force_all_finite=False)

        if not inplace:
            X = X.copy()

        if not fill_method:
            fill_method = self.fill_method

        if fill_method not in ("zero", "mean", "median", "min", "random"):
            raise ValueError("Invalid fill method: '%s'" % (fill_method))
        elif fill_method == "zero":
            # replace NaN's with 0
            X[missing_mask] = 0
        elif fill_method == "mean":
            self._fill_columns_with_fn(X, missing_mask, np.nanmean)
        elif fill_method == "median":
            self._fill_columns_with_fn(X, missing_mask, np.nanmedian)
        elif fill_method == "min":
            self._fill_columns_with_fn(X, missing_mask, np.nanmin)
        elif fill_method == "random":
            self._fill_columns_with_fn(
                X,
                missing_mask,
                col_fn=generate_random_column_samples)
        return X
def fill ( self , X , missing_mask , fill_method = None , inplace = False ) : X = check_array ( X , force_all_finite = False ) if not inplace : X = X . copy ( ) if not fill_method : fill_method = self . fill_method if fill_method not in ( "zero" , "mean" , "median" , "min" , "random" ) : raise ValueError ( "Invalid fill method: '%s'" % ( fill_method ) ) elif fill_method == "zero" : # replace NaN's with 0 X [ missing_mask ] = 0 elif fill_method == "mean" : self . _fill_columns_with_fn ( X , missing_mask , np . nanmean ) elif fill_method == "median" : self . _fill_columns_with_fn ( X , missing_mask , np . nanmedian ) elif fill_method == "min" : self . _fill_columns_with_fn ( X , missing_mask , np . nanmin ) elif fill_method == "random" : self . _fill_columns_with_fn ( X , missing_mask , col_fn = generate_random_column_samples ) return X