code: def reshape(self, data):
      index, agg, dropna = (
          self.cfg.get(p) for p in ["index", "agg", "dropna"]
      )
      agg_type, func, cols = (
          agg.get(p) for p in ["type", "func", "cols"]
      )
  
      if index:
          agg_data = pandas_util.groupby(
              data, index, dropna=dropna if dropna is not None else True
          )
          if agg_type == "func":
              if "count_pct" == func:
                  counts = agg_data.size()
                  return pd.DataFrame(
                      {
                          "Count": counts,
                          "Percentage": (counts / len(data)) * 100,
                      }
                  )
              if cols:
                  agg_data = agg_data[cols]
              elif pandas_util.is_pandas2():
                  non_str_cols = [
                      c
                      for c in data.select_dtypes(
                          exclude="object"
                      ).columns
                      if hasattr(agg_data, c) and c != index
                  ]
                  agg_data = agg_data[non_str_cols]
  
              return (
                  agg_data.agg(stats.gmean)
                  if func == "gmean"
                  else getattr(agg_data, func)()
              )
          agg_data = agg_data.aggregate(custom_aggregate_handler(cols))
          agg_data.columns = flatten_columns(agg_data)
          return agg_data
  
      agg_data = data[cols] if cols else data
      if agg_type == "func":
          agg_data = (
              agg_data.apply(stats.gmean)
              if func == "gmean"
              else getattr(agg_data, func)()
          )
          return agg_data.to_frame().T
  
      agg_data = agg_data.aggregate(custom_aggregate_handler(cols))
      agg_data = agg_data.to_frame().T
      return agg_data
  
imports: import pandas
  from scipy import stats
  import dtale.global_state
  import dtale.pandas_util
  from dtale.query import run_query
  from dtale.utils import make_list
label_desc: Use image node_id 2 for calling the AggregateBuilder obj's underlying member method code with example usage: obj.reshape(data) and returns: agg_data, agg_data, agg_data, unknown, pd