code: def test_annotation_to_data_frame(time_format):
      """Test annotation class to data frame conversion."""
      pytest.importorskip("pandas")
      onset = np.arange(1, 10)
      durations = np.full_like(onset, [4, 5, 6, 4, 5, 6, 4, 5, 6])
      description = ["yy"] * onset.shape[0]
  
      a = Annotations(
          onset=onset,
          duration=durations,
          description=description,
          orig_time=0,
      )
  
      df = a.to_data_frame(time_format=time_format)
      for col in ["onset", "duration", "description"]:
          assert col in df.columns
      assert df.description[0] == "yy"
      want = 1000 if time_format == "ms" else 1
      got = df.onset[1] - df.onset[0]
      if time_format in ("datetime", "timedelta"):
          got = got.seconds
      assert want == got
      assert df.groupby("description").count().onset["yy"] == 9
  
imports: import sys
  from collections import OrderedDict
  from datetime import datetime, timedelta, timezone
  from itertools import repeat
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from pytest import approx
  import mne
  from mne import Annotations, Epochs, annotations_from_events, count_annotations, create_info, events_from_annotations, read_annotations
  from mne.annotations import _handle_meas_date, _read_annotations_txt_parse_header, _sync_onset
  from mne.datasets import testing
  from mne.io import RawArray, concatenate_raws, read_raw_fif
  from mne.utils import _dt_to_stamp, _raw_annot, _record_warnings, _stamp_to_dt, assert_and_remove_boundary_annot, catch_logging, check_version
label_desc: Use image node_id 43 for calling a global function with example usage: test_annotation_to_data_frame(time_format) without return types