code: def test_to_data_frame_index(index):
      """Test index creation in epochs Pandas exporter."""
      # Create fake EpochsTFR data:
      pytest.importorskip("pandas")
      n_epos = 3
      ch_names = ["EEG 001", "EEG 002", "EEG 003", "EEG 004"]
      n_picks = len(ch_names)
      ch_types = ["eeg"] * n_picks
      n_freqs = 5
      n_times = 6
      data = np.random.rand(n_epos, n_picks, n_freqs, n_times)
      times = np.arange(6)
      freqs = np.arange(5)
      events = np.zeros((n_epos, 3), dtype=int)
      events[:, 0] = np.arange(n_epos)
      events[:, 2] = np.arange(5, 8)
      event_id = {
          k: v for v, k in zip(events[:, 2], ["ha", "he", "hu"])
      }
      info = mne.create_info(ch_names, 1000.0, ch_types)
      tfr = mne.time_frequency.EpochsTFR(
          info, data, times, freqs, events=events, event_id=event_id
      )
      df = tfr.to_data_frame(picks=[0, 2, 3], index=index)
      # test index order/hierarchy preservation
      if not isinstance(index, list):
          index = [index]
      assert df.index.names == index
      # test that non-indexed data were present as columns
      non_index = list(
          set(["condition", "time", "freq", "epoch"]) - set(index)
      )
      if len(non_index):
          assert all(np.isin(non_index, df.columns))
  
imports: import datetime
  import re
  from itertools import product
  from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_equal
  from scipy.signal import morlet2
  import mne
  from mne import Epochs, EpochsArray, Info, Transform, create_info, pick_types, read_events
  from mne.io import read_raw_fif
  from mne.tests.test_epochs import assert_metadata_equal
  from mne.time_frequency import tfr_array_morlet, tfr_array_multitaper
  from mne.time_frequency.tfr import AverageTFR, EpochsTFR, _compute_tfr, _make_dpss, combine_tfr, cwt, fwhm, morlet, read_tfrs, tfr_morlet, tfr_multitaper, write_tfrs
  from mne.utils import catch_logging, grand_average
  from mne.viz.utils import _fake_click, _fake_keypress, _fake_scroll
label_desc: Use image node_id 20 for calling a global function with example usage: test_to_data_frame_index(index) without return types