code: def pandas_input_fn(
      df,
      y_col=None,
      batch_size=128,
      num_epochs=1,
      shuffle=False,
      seed=None,
  ):
      """Pandas input function for TensorFlow high-level API Estimator.
      This function returns a `tf.data.Dataset` function.
  
      .. note::
  
          `tf.estimator.inputs.pandas_input_fn` cannot handle array/list column properly.
          For more information, see https://www.tensorflow.org/api_docs/python/tf/estimator/inputs/numpy_input_fn
  
      Args:
          df (pandas.DataFrame): Data containing features.
          y_col (str): Label column name if df has it.
          batch_size (int): Batch size for the input function.
          num_epochs (int): Number of epochs to iterate over data. If `None`, it will run forever.
          shuffle (bool): If True, shuffles the data queue.
          seed (int): Random seed for shuffle.
  
      Returns:
          tf.data.Dataset: Function.
      """
  
      X_df = df.copy()
      if y_col is not None:
          y = X_df.pop(y_col).values
      else:
          y = None
  
      X = {}
      for col in X_df.columns:
          values = X_df[col].values
          if isinstance(values[0], (list, np.ndarray)):
              values = np.array(values.tolist(), dtype=np.float32)
          X[col] = values
  
      return lambda: _dataset(
          x=X,
          y=y,
          batch_size=batch_size,
          num_epochs=num_epochs,
          shuffle=shuffle,
          seed=seed,
      )
  
imports: import itertools
  import numpy
  import tensorflow
  from tensorflow_estimator.python.estimator.export.export import build_supervised_input_receiver_fn_from_input_fn
label_desc: Use image node_id 2 for calling a global function with example usage: pandas_input_fn(df, y_col, batch_size, num_epochs, shuffle, seed) and returns: function