code: def construct_index(series: pd.Series, index_type: str) -> pd.Index:
      """Construct an index of the given type for the given series.
  
      series: pd.Series
          The series to construct an index for
      index_type: str
          One of "range", "datetime", "timedelta", "float", or "int"
      """
      if index_type == "range":
          return pd.RangeIndex(len(series))
      if index_type == "datetime":
          return pd.date_range(
              "1/1/2020", periods=len(series), freq="1ms"
          )
      if index_type == "timedelta":
          return pd.timedelta_range(
              start="0s", periods=len(series), freq="1ms"
          )
      if index_type == "float":
          return pd.Float64Index(np.arange(len(series)))
      if index_type == "int":
          return pd.Int64Index(np.arange(len(series)))
      raise ValueError(f"Unknown index type: {index_type}")
  
file_path: plotly-resampler/tests/utils.py
imports: from __future__ import annotations
  import sys
  import numpy
  import pandas
  from plotly_resampler.aggregation import MedDiffGapHandler, MinMaxLTTB
  from plotly_resampler.aggregation.aggregation_interface import DataAggregator, DataPointSelector
  from plotly_resampler.aggregation.gap_handler_interface import AbstractGapHandler
  from plotly_resampler.aggregation.plotly_aggregator_parser import PlotlyAggregatorParser
label_desc: Use image node_id 4 for calling a global function with example usage: construct_index(series, index_type) and returns: pd, pd, pd, pd, pd