class_docstr: Counts the number of cases at each x position
  
  {usage}
  
  Parameters
  ----------
  {common_parameters}
  width : float, default=None
      Bar width. If None, set to 90% of the resolution of the data.
  
  See Also
  --------
  plotnine.stats.stat_bin
class_docstr_tok: ["Counts","the","number","of","cases","at","each","x","position","{","usage","}","Parameters","--","--","--","--","--","{","common_parameters","}","width",":","float",",","default=None","Bar","width",".","If","None",",","set","to","90","%","of","the","resolution","of","the","data",".","See","Also","--","--","--","--","plotnine.stats.stat_bin"]
code: def compute_group(cls, data, scales, **params):
      x = data["x"]
      if ("y" in data) or ("y" in params):
          msg = "stat_count() must not be used with a y aesthetic"
          raise PlotnineError(msg)
  
      weight = data.get("weight", [1] * len(x))  # pyright: ignore
      width = params["width"]
      xdata_long = pd.DataFrame({"x": x, "weight": weight})
      # weighted frequency count
      count = xdata_long.pivot_table(
          "weight", index=["x"], aggfunc="sum"
      )["weight"]
      x = count.index
      count = count.to_numpy()
      return pd.DataFrame(
          {
              "count": count,
              "prop": count / np.abs(count).sum(),
              "x": x,
              "width": width,
          }
      )
  
file_path: plotnine/plotnine/stats/stat_count.py
imports: import numpy
  import pandas
  from .._utils import resolution
  from ..doctools import document
  from ..exceptions import PlotnineError
  from ..mapping.evaluation import after_stat
  from .stat import stat
label_desc: Use image node_id 2 for calling the stat_count obj's underlying member method code with example usage: obj.compute_group(cls, data, scales) and returns: pd