code: def correct_string_target(
      y: Union[pd.Series, np.ndarray]
  ) -> Union[pd.Series, np.ndarray]:
      if isinstance(y, pd.Series):
          return y.astype(str).astype("category").cat.codes
      elif isinstance(y, np.ndarray):
          return (
              pd.Series(y)
              .astype(str)
              .astype("category")
              .cat.codes.values
          )
  
file_path: upgini/src/upgini/utils/target_utils.py
imports: import logging
  from typing import Optional, Union
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype
  from upgini.errors import ValidationError
  from upgini.metadata import ModelTaskType
  from upgini.resource_bundle import bundle
label_desc: Use image node_id 1 for calling a global function with example usage: correct_string_target(y) and returns: y, pd