code: def kde_count(
      data: FloatArray, grid: FloatArray, **kwargs: Any
  ) -> FloatArray:
      """
      Kernel Density Estimation via count within radius
  
      Parameters
      ----------
      data :
          Data points used to compute a density estimator. It
          has `n x p` dimensions, representing n points and p
          variables.
      grid :
          Data points at which the desity will be estimated. It
          has `m x p` dimensions, representing m points and p
          variables.
  
      Returns
      -------
      out :
          Density estimate. Has `m x 1` dimensions
      """
      r = kwargs.get("radius", np.ptp(data) / 10)
  
      # Get the number of data points within the radius r of each grid point
      iter = (
          np.sum(np.linalg.norm(data - g, axis=1) < r) for g in grid
      )
      count = np.fromiter(iter, float, count=data.shape[0])
  
      # Get fraction of data within radius
      density = count / data.shape[0]
  
      return density
  
file_path: plotnine/plotnine/stats/density.py
imports: from __future__ import annotations
  import typing
  import numpy
  from .._utils import array_kind
label_desc: Use image node_id 5 for calling a global function with example usage: kde_count(data, grid) and returns: density