class_docstr: Computes a 1D kernel density estimate (KDE) along the supplied
  dimension. Kernel density estimation is a non-parametric way to
  estimate the probability density function of a random variable.
  
  The KDE works by placing a Gaussian kernel at each sample with
  the supplied bandwidth. These kernels are then summed to produce
  the density estimate. By default a good bandwidth is determined
  using the bw_method but it may be overridden by an explicit value.
class_docstr_tok: ["Computes","a","1D","kernel","density","estimate","(","KDE",")","along","the","supplied","dimension",".","Kernel","density","estimation","is","a","non-parametric","way","to","estimate","the","probability","density","function","of","a","random","variable",".","The","KDE","works","by","placing","a","Gaussian","kernel","at","each","sample","with","the","supplied","bandwidth",".","These","kernels","are","then","summed","to","produce","the","density","estimate",".","By","default","a","good","bandwidth","is","determined","using","the","bw_method","but","it","may","be","overridden","by","an","explicit","value","."]
code: def _process(self, element, key=None):
      if self.p.groupby:
          if not isinstance(element, Dataset):
              raise ValueError(
                  "Cannot use histogram groupby on non-Dataset Element"
              )
          grouped = element.groupby(
              self.p.groupby,
              group_type=Dataset,
              container_type=NdOverlay,
          )
          self.p.groupby = None
          return grouped.map(self._process, Dataset)
  
      try:
          from scipy import stats
          from scipy.linalg import LinAlgError
      except ImportError:
          raise ImportError(
              f"{type(self).__name__} operation requires SciPy to be installed."
          ) from None
  
      params = {}
      if isinstance(element, Distribution):
          selected_dim = element.kdims[0]
          if element.group != type(element).__name__:
              params["group"] = element.group
          params["label"] = element.label
          vdim = element.vdims[0]
          vdim_name = f"{selected_dim.name}_density"
          vdims = [
              vdim.clone(vdim_name, label="Density")
              if vdim.name == "Density"
              else vdim
          ]
      else:
          if self.p.dimension:
              selected_dim = element.get_dimension(self.p.dimension)
          else:
              dimensions = element.vdims + element.kdims
              if not dimensions:
                  raise ValueError(
                      "%s element does not declare any dimensions "
                      "to compute the kernel density estimate on."
                      % type(element).__name__
                  )
              selected_dim = dimensions[0]
          vdim_name = f"{selected_dim.name}_density"
          vdims = [Dimension(vdim_name, label="Density")]
  
      data = element.dimension_values(selected_dim)
      bin_range = self.p.bin_range or element.range(selected_dim)
      if bin_range == (0, 0) or any(not isfinite(r) for r in bin_range):
          bin_range = (0, 1)
      elif bin_range[0] == bin_range[1]:
          bin_range = (bin_range[0] - 0.5, bin_range[1] + 0.5)
  
      element_type = Area if self.p.filled else Curve
      data = data[isfinite(data)] if len(data) else []
      if len(data) > 1:
          try:
              kde = stats.gaussian_kde(data)
          except LinAlgError:
              return element_type([], selected_dim, vdims, **params)
          if self.p.bandwidth:
              kde.set_bandwidth(self.p.bandwidth)
          bw = kde.scotts_factor() * data.std(ddof=1)
          if self.p.bin_range:
              xs = np.linspace(
                  bin_range[0], bin_range[1], self.p.n_samples
              )
          else:
              xs = _kde_support(
                  bin_range,
                  bw,
                  self.p.n_samples,
                  self.p.cut,
                  selected_dim.range,
              )
          ys = kde.evaluate(xs)
      else:
          xs = np.linspace(bin_range[0], bin_range[1], self.p.n_samples)
          ys = np.full_like(xs, 0)
  
      return element_type(
          (xs, ys), kdims=[selected_dim], vdims=vdims, **params
      )
  
file_path: holoviews/holoviews/operation/stats.py
imports: import numpy
  import param
  from ..core import Dataset, Dimension, NdOverlay
  from ..core.operation import Operation
  from ..core.util import cartesian_product, isfinite
  from ..element import Area, Bivariate, Contours, Curve, Distribution, Image, Polygons
  from .element import contours
label_desc: Use image node_id 1 for calling the univariate_kde obj's underlying member method code with example usage: obj._process(element, key) and returns: element_type, grouped, element_type