code: def load_baselines(base_dir, verbose=False):
      """Reads in the baseline experimental data from a specified base directory.
  
      Args:
        base_dir: string, base directory where to read data from.
        verbose: bool, whether to print warning messages.
  
      Returns:
        A dict containing pandas DataFrames for all available agents and games.
      """
      experimental_data = {}
      for game in ALL_GAMES:
          for agent in ["dqn", "c51", "rainbow", "iqn"]:
              game_data_file = os.path.join(
                  base_dir, agent, "{}.pkl".format(game)
              )
              if not tf.io.gfile.exists(game_data_file):
                  if verbose:
                      # pylint: disable=superfluous-parens
                      print(
                          "Unable to load data for agent {} on game {}".format(
                              agent, game
                          )
                      )
                      # pylint: enable=superfluous-parens
                  continue
              with tf.io.gfile.GFile(game_data_file, "rb") as f:
                  if sys.version_info.major >= 3:
                      # pylint: disable=unexpected-keyword-arg
                      single_agent_data = pickle.load(
                          f, encoding="latin1"
                      )
                      # pylint: enable=unexpected-keyword-arg
                  else:
                      single_agent_data = pickle.load(f)
                  single_agent_data["agent"] = agent
                  # The dataframe rows are all read as 'objects', which causes a
                  # ValueError when merging below. We cast the numerics to float64s to
                  # avoid this.
                  for field_name in single_agent_data.keys():
                      try:
                          single_agent_data[
                              field_name
                          ] = single_agent_data[field_name].astype(
                              np.float64
                          )
                      except ValueError:
                          # This will catch any non-numerics that cannot be cast to float64.
                          continue
                  if game in experimental_data:
                      experimental_data[game] = experimental_data[
                          game
                      ].merge(single_agent_data, how="outer")
                  else:
                      experimental_data[game] = single_agent_data
      return experimental_data
  
file_path: dopamine/dopamine/colab/utils.py
imports: import itertools
  import os
  import pickle
  import sys
  import numpy
  import pandas
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: load_baselines(base_dir, verbose) and returns: experimental_data