code: def summarize_data(data, summary_keys):
      """Processes log data into a per-iteration summary.
  
      Args:
        data: Dictionary loaded by load_statistics describing the data. This
          dictionary has keys iteration_0, iteration_1, ... describing per-iteration
          data.
        summary_keys: List of per-iteration data to be summarized.
  
      Example:
        data = load_statistics(...)
        summarize_data(data, ['train_episode_returns',
            'eval_episode_returns'])
  
      Returns:
        A dictionary mapping each key in returns_keys to a per-iteration summary.
      """
      summary = {}
      latest_iteration_number = len(data.keys())
      current_value = None
  
      for key in summary_keys:
          summary[key] = []
          # Compute per-iteration average of the given key.
          for i in range(latest_iteration_number):
              iter_key = "{}{}".format(ITERATION_PREFIX, i)
              # We allow reporting the same value multiple times when data is missing.
              # If there is no data for this iteration, use the previous'.
              if iter_key in data:
                  current_value = np.mean(data[iter_key][key])
              summary[key].append(current_value)
  
      return summary
  
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 5 for calling a global function with example usage: summarize_data(data, summary_keys) and returns: summary