code: def compute_kde(sdf, bw_method=None, ind=None):
      # 'sdf' is a Spark DataFrame that selects one column.
  
      # Using RDD is slow so we might have to change it to Dataset based implementation
      # once Spark has that implementation.
      sample = sdf.rdd.map(lambda x: float(x[0]))
      kd = KernelDensity()
      kd.setSample(sample)
  
      assert isinstance(
          bw_method, (int, float)
      ), "'bw_method' must be set as a scalar number."
  
      if bw_method is not None:
          # Match the bandwidth with Spark.
          kd.setBandwidth(float(bw_method))
      return kd.estimate(list(map(float, ind)))
  
imports: import importlib
  import pandas
  import numpy
  from pandas.core.base import PandasObject
  from pandas.core.dtypes.inference import is_integer
  from pyspark.ml.feature import Bucketizer
  from pyspark.mllib.stat import KernelDensity
  from pyspark.sql import functions
  from pyspark.pandas.missing import unsupported_function
  from pyspark.pandas.config import get_option
  from pyspark.pandas.utils import name_like_string
label_desc: Use image node_id 3 for calling the KdePlotBase obj's underlying member method code with example usage: obj.compute_kde(sdf, bw_method, ind) and returns: kd