title: Organizing csv data and computing average grades
body: <p>I have a sample csv data of classes and grades with over 500 rows and it looks something like this</p>
  
  <pre><code>courseid  title  teacher  avggpa  students As   Bs   Cs    Ds   Fs
  101       Math   Stevens  3.15    105      25.2 45.1 16.7  10.1 2.9
  101       Math   Stevens  2.98    95       20.2 30.1 30.5  11.5 5.4
  101       Math   Smith    3.33    120      33.1 40.1 10.2  7.6  4.3
  103      English Jane     3.55    108      20.5 16.2 16.5  20.5 10.2
  103      English Jane     3.47    100      25.2 38.0 22.0  7.0  2.0
  202      Science Roberts  2.67    80       12.0 35.0 27.5  12.5 8.3
  </code></pre>
  
  <p>(Pretend that those are comma separated, I just typed it up for formatting purposes. Also percentages don't add up to 100% but pretend they do)</p>
  
  <p>so far what I have is:</p>
  
  <pre><code>with open(filename, 'rb') as f:
      reader = csv.reader(f, delimiter=',')
      next(reader, None)                        #to skip header
      self.data = list(reader)
  
  case_list = []
  for entry in self.data:
      case = {'course_number': entry[1], 'course_title': entry[2], 'teacher': entry[3]... #and so on for each header
      case_list.append(case)
  </code></pre>
  
  <p>So I have a list of dictionaries where each dictionary entry is one row from the csv file.</p>
  
  <p>My goal is to combine and average the avggpa and As, Bs, Cs, Ds, Fs from teachers who teach the same course more than once. So in my example, I would like to average the grades of Steven's and Jane's classes, and then represent that with a visual. If a teacher only teaches one course, I would also like to represent his grades with a visual.</p>
  
  <p>I'm struggling with coming up with a method to determine if a teacher teaches more than one course. Something along the lines of looping through the list and checking if the courseid and teacher is already in the dictionary, and then calling a function to average the gpas if so, but I can't seem to think out the logic. </p>
  
  <p>Any help would be greatly appreciated and if more clarification is needed please let me know. If there is also a better approach to organizing the csv data than what I initially did, please let me know!</p>