code: def _cast_object_to_string(
      data_frame: pandas.DataFrame,
  ) -> pandas.DataFrame:
      """Cast properly pandas object types to strings
  
      Description:
          Method to convert 'object' and 'O' column dtypes of a pandas.DataFrame to
          a valid string type recognized by Feature Groups.
  
      Args:
          data_frame: dataframe used
      Returns:
          pandas.DataFrame
      """
      for label in data_frame.select_dtypes(
          ["object", "O"]
      ).columns.tolist():
          data_frame[label] = (
              data_frame[label].astype("str").astype("string")
          )
      return data_frame
  
file_path: sagemaker-python-sdk/src/sagemaker/feature_store/feature_utils.py
imports: from __future__ import absolute_import
  import re
  import logging
  from typing import Union
  from pathlib import Path
  import pandas
  import boto3
  from pandas import DataFrame, Series, read_csv
  from sagemaker.feature_store.feature_group import FeatureGroup
  from sagemaker.session import Session
label_desc: Use image node_id 4 for calling a global function with example usage: _cast_object_to_string(data_frame) and returns: data_frame