code: def search_to_df(word, col, df, as_string=False):
      """
      A simple way to retrieve entries from a given (edge) col in a dataframe
      :eg
          search_to_df('BlackRock', 'to_node', edf)
  
      :param word: str search term
      :param col: given column of dataframe
      :param df: pandas dataframe
      :param as_string: if True, will coerce the column `col` to string, default False.
      :returns
          DataFrame of results, or empty DataFrame if None are found
      """
      try:
          if as_string:
              res = df[
                  df[col].astype(str).str.contains(word, case=False)
              ]
          else:
              res = df[df[col].str.contains(word, case=False)]
      except TypeError as e:
          logger.error(e)
          return pd.DataFrame([], columns=df.columns)
      return res
  
file_path: pygraphistry/graphistry/ai_utils.py
imports: import pandas
  import numpy
  import graphistry
  from .constants import DISTANCE, WEIGHT, BATCH
  from logging import getLogger
label_desc: Use image node_id 1 for calling a global function with example usage: search_to_df(word, col, df, as_string) and returns: res, pd