code: def build_code(self):
      index, columns, values, aggfunc = (
          self.cfg.get(p)
          for p in ["index", "columns", "values", "aggfunc"]
      )
      code = []
      if aggfunc is not None or len(values) > 1:
          code.append(
              "df = pd.pivot_table(df, index='{}', columns='{}', values=['{}'], aggfunc='{}')".format(
                  index, columns, "', '".join(values), aggfunc
              )
          )
          if len(values) > 1:
              code.append(
                  "df.columns = [' '.join([str(c) for c in col]).strip() for col in df.columns.values]"
              )
          elif len(values) == 1:
              code.append("df.columns = df.columns.droplevel(0)")
      else:
          code.append(
              "df = df.pivot(index='{index}', columns='{columns}', values='{values}')".format(
                  index=index, columns=columns, values=values[0]
              )
          )
      code.append("df = df.rename_axis(None, axis=1)")
      return "\n".join(code)
  
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 3 for calling the PivotBuilder obj's underlying member method code with example usage: obj.build_code() and returns: str