code: def manual_partial_dependence(model, datafile, xlist, xname, weightV):
      dataframe = h2o.import_file(pyunit_utils.locate(datafile))
      meanV = []
      stdV = []
      stderrV = []
      nRows = dataframe.nrow
      nCols = dataframe.ncol - 1
  
      for xval in xlist:
          cons = [xval] * nRows
          if xname in dataframe.names:
              dataframe = dataframe.drop(xname)
          if not (
              (is_type(xval, str) and xval == "NA")
              or (isinstance(xval, float) and math.isnan(xval))
          ):
              dataframe = dataframe.cbind(h2o.H2OFrame(cons))
              dataframe.set_name(nCols, xname)
  
          pred = model.predict(dataframe).as_data_frame(
              use_pandas=False, header=False
          )
          pIndex = len(pred[0]) - 1
          sumEle = 0.0
          sumEleSq = 0.0
          sumWeight = 0.0
          numNonZeroWeightCount = 0.0
          m = 1.0 / math.sqrt(dataframe.nrow * 1.0)
          for rindex in range(len(pred)):
              val = float(pred[rindex][pIndex])
              weight = weightV[rindex]
              if (
                  (abs(weight) > 0)
                  and isinstance(val, float)
                  and not (math.isnan(val))
              ):
                  temp = val * weight
                  sumEle = sumEle + temp
                  sumEleSq = sumEleSq + temp * val
                  sumWeight = sumWeight + weight
                  numNonZeroWeightCount = numNonZeroWeightCount + 1
          wMean = sumEle / sumWeight
          scale = (
              numNonZeroWeightCount * 1.0 / (numNonZeroWeightCount - 1)
          )
          wSTD = math.sqrt(
              (sumEleSq / sumWeight - wMean * wMean) * scale
          )
          meanV.append(wMean)
          stdV.append(wSTD)
          stderrV.append(wSTD * m)
  
      return meanV, stdV, stderrV
  
file_path: h2o-3/h2o-py/tests/testdir_misc/pyunit_pubdev_5761_pdp_NA.py
imports: import sys
  import h2o
  import math
  from tests import pyunit_utils
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  import random
  from h2o.utils.typechecks import is_type
label_desc: Use image node_id 3 for calling a global function with example usage: manual_partial_dependence(model, datafile, xlist, xname, weightV) and returns: meanV,  stdV,  stderrV