def parse_csv_results(csv_obj, upper_limit_data):
  """ Parses the raw CSV data
  Convers the csv_obj into an array of valid values for averages and
  confidence intervals based on the described upper_limits.

  Args:
    csv_obj: An array of rows (dict) descriving the CSV results
    upper_limit_data: A dictionary containing the upper limits of each story

  Raturns:
    A dictionary which has the stories as keys and an array of confidence
    intervals and valid averages as data.
  """
  values_per_story = {}
  for row in csv_obj:
    # For now only frame_times is used for testing representatives'
    # performance.
    if row['name'] != 'frame_times':
      continue
    story_name = row['stories']
    if (story_name not in upper_limit_data):
      continue
    if story_name not in values_per_story:
      values_per_story[story_name] = {
        'averages': [],
        'ci_095': []
      }

    if (row['avg'] == '' or row['count'] == 0):
      continue
    values_per_story[story_name]['ci_095'].append(float(row['ci_095']))
    values_per_story[story_name]['averages'].append(float(row['avg']))

  return values_per_story