code: def convert_mushroom_csv_to_tf_dataset(file_path, buffer_size=40000):
      """Converts the mushroom CSV dataset into a `tf.Dataset`.
  
      The dataset CSV contains the label in the first column, then the features.
      Two example rows:
        `p,x,s,n,t,p,f,c,n,k,e,e,s,s,w,w,p,w,o,p,k,s,u`: poisonous;
        `e,x,s,y,t,a,f,c,b,k,e,c,s,s,w,w,p,w,o,p,n,n,g`: edible.
  
      Args:
        file_path: Path to the CSV file.
        buffer_size: The buffer to use for shuffling the data.
  
      Returns:
        A `tf.Dataset`, infinitely looped, shuffled, not batched.
  
      Raises:
        AssertionError: If the CSV file does not conform to the syntax of the
          mushroom environment.
      """
      with tf.io.gfile.GFile(file_path, "r") as infile:
          nd = np.genfromtxt(infile, dtype=str, delimiter=",")
      _validate_mushroom_data(nd)
      encoded = _one_hot(nd)
      contexts = encoded[:, 2:]
      context_tensor = tf.cast(contexts, tf.float32)
      labels = encoded[:, 0]
      label_tensor = tf.cast(labels, tf.int32)
      dataset = tf.data.Dataset.from_tensor_slices(
          (context_tensor, label_tensor)
      )
      return dataset.repeat().shuffle(buffer_size=buffer_size)
  
file_path: agents/tf_agents/bandits/environments/dataset_utilities.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import csv
  import gin
  import numpy
  from six.moves import range
  from six.moves import zip
  import tensorflow
  import tensorflow_probability
label_desc: Use image node_id 3 for calling a global function with example usage: convert_mushroom_csv_to_tf_dataset(file_path, buffer_size) and returns: dataset