code: def set_pandas_df_type_index(
      pd_df, squeeze=False, index_col=None, dtype=None, index_map=None
  ):
      if dtype is not None:
          if isinstance(dtype, dict):
              for col, type in dtype.items():
                  if isinstance(col, str):
                      if col not in pd_df.columns:
                          invalidInputError(
                              False,
                              "column to be set type is not"
                              " in current dataframe",
                          )
                      pd_df[col] = pd_df[col].astype(type)
                  elif isinstance(col, int):
                      if index_map[col] not in pd_df.columns:
                          invalidInputError(
                              False,
                              "column index to be set type is not"
                              " in current dataframe",
                          )
                      pd_df[index_map[col]] = pd_df[
                          index_map[col]
                      ].astype(type)
          else:
              pd_df = pd_df.astype(dtype)
      if squeeze and len(pd_df.columns) == 1:
          pd_df = pd_df.iloc[:, 0]
      if index_col:
          pd_df = pd_df.set_index(index_col)
      return pd_df
  
imports: from bigdl.dllib.utils.file_utils import get_file_list, callZooFunc
  from bigdl.dllib.utils.utils import convert_row_to_numpy
  from bigdl.dllib.utils.common import *
  from bigdl.dllib.utils.log4Error import *
  import pyspark.sql.functions
  from typing import TYPE_CHECKING, Dict, List, Optional, Type, Union
  from numpy import float32, int32
label_desc: Use image node_id 22 for calling a global function with example usage: set_pandas_df_type_index(pd_df, squeeze, index_col, dtype, index_map) and returns: pd_df