code: def _build_data_frame(
      inst,
      data,
      picks,
      long_format,
      mindex,
      index,
      default_index,
      col_names=None,
      col_kind="channel",
      verbose=None,
  ):
      """Build DataFrame from MNE-object-derived data array."""
      # private function; pandas already checked in calling function
      from pandas import DataFrame
  
      from ..source_estimate import _BaseSourceEstimate
  
      # build DataFrame
      if col_names is None:
          col_names = [inst.ch_names[p] for p in picks]
      df = DataFrame(data, columns=col_names)
      for i, (k, v) in enumerate(mindex):
          df.insert(i, k, v)
      # build Index
      if long_format:
          df = _inplace(df, "set_index", keys=default_index)
          df.columns.name = col_kind
      elif index is not None:
          df = _inplace(df, "set_index", keys=index)
          if set(index) == set(default_index):
              df.columns.name = col_kind
      # long format
      if long_format:
          df = df.stack().reset_index()
          df = _inplace(df, "rename", columns={0: "value"})
          # add column for channel types (as appropriate)
          ch_map = (
              None
              if isinstance(inst, _BaseSourceEstimate)
              else dict(
                  zip(
                      np.array(inst.ch_names)[picks],
                      np.array(inst.get_channel_types())[picks],
                  )
              )
          )
          if ch_map is not None:
              col_index = len(df.columns) - 1
              ch_type = df["channel"].map(ch_map)
              df.insert(col_index, "ch_type", ch_type)
          # restore index
          if index is not None:
              df = _inplace(df, "set_index", keys=index)
          # convert channel/vertex/ch_type columns to factors
          to_factor = [
              c
              for c in df.columns.tolist()
              if c not in ("freq", "time", "value")
          ]
          _set_pandas_dtype(df, to_factor, "category")
      return df
  
file_path: mne-python/mne/utils/dataframe.py
imports: from inspect import signature
  import numpy
  from ..defaults import _handle_default
  from ._logging import logger, verbose
label_desc: Use image node_id 5 for calling a global function with example usage: _build_data_frame(inst, data, picks, long_format, mindex, index, default_index, col_names, col_kind, verbose) and returns: df