code: def get_mean(data_np):
      
      i = np.isfinite(data_np)
      if not np.any(i):
          return np.nan
      return np.mean(data_np[i])
docs: Calculate mean for valid values.
  
      Parameters
      ----------
      data_np : ndarray
          Input array.
  
      Returns
      -------
      result : float
          Mean of array values that are finite.
          If array contains no finite values, returns NaN.