class_docstr: Builds graphs and other summary information from eventlogs.
docstr: Combines data from multipole runs into a pivot table like structure.
  
  Uses the first run as the base and aligns the data for each run by rows
  with each row representing a step. If a step is not found in a run,
  the value -1 is used. No error or warning is thrown or logged.
  
  Args:
    data_collector: list of dicts with each dict representing a run most
      likely extracted from an event log.
  
  Returns:
    2d array with each row representing a step and each run represented as
    a column, e.g. step, run 1, run 2, median, and mean.
docstr_tok: ["Combines","data","from","multipole","runs","into","a","pivot","table","like","structure",".","Uses","the","first","run","as","the","base","and","aligns","the","data","for","each","run","by","rows","with","each","row","representing","a","step",".","If","a","step","is","not","found","in","a","run",",","the","value","-1","is","used",".","No","error","or","warning","is","thrown","or","logged",".","Args",":","data_collector",":","list","of","dicts","with","each","dict","representing","a","run","most","likely","extracted","from","an","event","log",".","Returns",":","2d","array","with","each","row","representing","a","step","and","each","run","represented","as","a","column",",","e.g",".","step",",","run","1",",","run","2",",","median",",","and","mean","."]
code: def _align_and_aggregate(
      self, data_collector: List[Dict[int, np.generic]]
  ) -> List[Sequence[Number]]:
      """Combines data from multipole runs into a pivot table like structure.
  
      Uses the first run as the base and aligns the data for each run by rows
      with each row representing a step. If a step is not found in a run,
      the value -1 is used. No error or warning is thrown or logged.
  
      Args:
        data_collector: list of dicts with each dict representing a run most
          likely extracted from an event log.
  
      Returns:
        2d array with each row representing a step and each run represented as
        a column, e.g. step, run 1, run 2, median, and mean.
      """
      # Use the first event log's steps as the base and create aggregated data
      # at the step internals of the first event log.
      base_data = data_collector[0]
      agg_data = []
      for key, value in sorted(base_data.items()):
          entry = [key]
          values = [value]
          for data in data_collector[1:]:
              values.append(data.get(key, -1))
          mean_val = np.mean(values)
          median_val = np.median(values)
  
          # Combines into step, values 1..n, median, and mean.
          values.append(median_val)
          values.append(mean_val)
          entry += values
          agg_data.append(entry)
      return agg_data
  
imports: import csv
  import enum
  import os
  from typing import Dict, List, Optional, Sequence, Tuple, Union
  from absl import app
  from absl import flags
  from absl import logging
  import matplotlib.pyplot
  import numpy
  import pandas
  import seaborn
  from tf_agents.benchmark import utils
label_desc: Use image node_id 3 for calling the StatsBuilder obj's underlying member method code with example usage: obj._align_and_aggregate(data_collector) and returns: agg_data