class_docstr: Calculate summary statistics depending on x
  
  {usage}
  
  Parameters
  ----------
  {common_parameters}
  fun_data : str | callable, default="mean_cl_boot"
      If string, it should be one of:
  
      ```python
      # Bootstrapped mean, confidence interval
      # Arguments:
      #     n_samples - No. of samples to draw
      #     confidence_interval
      #     random_state
      "mean_cl_boot"
  
      # Mean, C.I. assuming normal distribution
      # Arguments:
      #     confidence_interval
      "mean_cl_normal"
  
      # Mean, standard deviation * constant
      # Arguments:
      #     mult - multiplication factor
      "mean_sdl"
  
      # Median, outlier quantiles with equal tail areas
      # Arguments:
      #     confidence_interval
      "median_hilow"
  
      # Mean, Standard Errors * constant
      # Arguments:
      #     mult - multiplication factor
      "mean_se"
      ```
  
      or any function that takes a array and returns a dataframe
      with three columns named `y`, `ymin` and `ymax`.
  fun_y : callable, default=None
      Any function that takes a array_like and returns a value
  fun_ymin : callable, default=None
      Any function that takes an array_like and returns a value
  fun_ymax : callable, default=None
      Any function that takes an array_like and returns a value
  fun_args : dict, default=None
      Arguments to any of the functions. Provided the names of the
      arguments of the different functions are in not conflict, the
      arguments will be assigned to the right functions. If there is
      a conflict, create a wrapper function that resolves the
      ambiguity in the argument names.
  random_state : int | ~numpy.random.RandomState, default=None
      Seed or Random number generator to use. If `None`, then
      numpy global generator :class:`numpy.random` is used.
  
  Notes
  -----
  If any of `fun_y`, `fun_ymin` or `fun_ymax` are provided, the
  value of `fun_data` will be ignored.
  
  See Also
  --------
  plotnine.geoms.geom_pointrange
class_docstr_tok: ["Calculate","summary","statistics","depending","on","x","{","usage","}","Parameters","--","--","--","--","--","{","common_parameters","}","fun_data",":","str","|","callable",",","default=","''","mean_cl_boot","''","If","string",",","it","should","be","one","of",":","``","`","python","#","Bootstrapped","mean",",","confidence","interval","#","Arguments",":","#","n_samples","-","No",".","of","samples","to","draw","#","confidence_interval","#","random_state","``","mean_cl_boot","''","#","Mean",",","C.I",".","assuming","normal","distribution","#","Arguments",":","#","confidence_interval","``","mean_cl_normal","''","#","Mean",",","standard","deviation","*","constant","#","Arguments",":","#","mult","-","multiplication","factor","``","mean_sdl","''","#","Median",",","outlier","quantiles","with","equal","tail","areas","#","Arguments",":","#","confidence_interval","``","median_hilow","''","#","Mean",",","Standard","Errors","*","constant","#","Arguments",":","#","mult","-","multiplication","factor","``","mean_se","''","``","`","or","any","function","that","takes","a","array","and","returns","a","dataframe","with","three","columns","named","`","y","`",",","`","ymin","`","and","`","ymax","`",".","fun_y",":","callable",",","default=None","Any","function","that","takes","a","array_like","and","returns","a","value","fun_ymin",":","callable",",","default=None","Any","function","that","takes","an","array_like","and","returns","a","value","fun_ymax",":","callable",",","default=None","Any","function","that","takes","an","array_like","and","returns","a","value","fun_args",":","dict",",","default=None","Arguments","to","any","of","the","functions",".","Provided","the","names","of","the","arguments","of","the","different","functions","are","in","not","conflict",",","the","arguments","will","be","assigned","to","the","right","functions",".","If","there","is","a","conflict",",","create","a","wrapper","function","that","resolves","the","ambiguity","in","the","argument","names",".","random_state",":","int","|","~numpy.random.RandomState",",","default=None","Seed","or","Random","number","generator","to","use",".","If","`","None","`",",","then","numpy","global","generator",":","class",":","`","numpy.random","`","is","used",".","Notes","--","--","-","If","any","of","`","fun_y","`",",","`","fun_ymin","`","or","`","fun_ymax","`","are","provided",",","the","value","of","`","fun_data","`","will","be","ignored",".","See","Also","--","--","--","--","plotnine.geoms.geom_pointrange"]
code: def compute_panel(cls, data, scales, **params):
      func = make_summary_fun(
          params["fun_data"],
          params["fun_y"],
          params["fun_ymin"],
          params["fun_ymax"],
          params["fun_args"],
      )
  
      # break a dataframe into pieces, summarise each piece,
      # and join the pieces back together, retaining original
      # columns unaffected by the summary.
      summaries = []
      for (group, x), df in data.groupby(["group", "x"]):
          summary = func(df)
          summary["x"] = x
          summary["group"] = group
          summary["n"] = len(df)
          unique = uniquecols(df)
          if "y" in unique:
              unique = unique.drop("y", axis=1)
          merged = summary.merge(unique, on=["group", "x"])
          summaries.append(merged)
  
      new_data = pd.concat(summaries, axis=0, ignore_index=True)
      return new_data
  
file_path: plotnine/plotnine/stats/stat_summary.py
imports: import numpy
  import pandas
  from .._utils import get_valid_kwargs, uniquecols
  from ..doctools import document
  from ..exceptions import PlotnineError
  from .stat import stat
label_desc: Use image node_id 2 for calling the stat_summary obj's underlying member method code with example usage: obj.compute_panel(cls, data, scales) and returns: new_data