code: def fill_missing_with_mean(D, default=0.0):
      """fill missing value with the means of non-missing values in the column
  
      Parameters
      ----------
      D : array, shape(n, m)
          raw data matrix
      default : float
          default value if all values are NaN
  
      Returns
      -------
      D : array, shape(n, m)
          a data matrix whose missing values are filled
      """
  
      for i in range(D.shape[1]):
          if np.any(np.isnan(D[:, i])):
              v = np.mean(D[np.isfinite(D[:, i]), i])
              if np.isnan(v):
                  v = default
              D[np.isnan(D[:, i]), i] = v
  
      return D
  
imports: import sys
  import logging
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: fill_missing_with_mean(D, default) and returns: D