title: Python Export to Csv
body: <p>This is the <code>data</code> i am working with (Sample):</p>
  
  <pre><code>('Bouwmeester', [(0, 37), (155, 194), (327, 420), (541, 602), (654, 717), (761, 834), (1001, 1052), (0, 27), (79, 119), (405, 460), (546, 624), (750, 798), (834, 897), (1061, 1139), (0, 33), (170, 204), (289, 328), (447, 498), (575, 576), (729, 766), (962, 995), (1073, 1113), (1163, 1200)])
  ('Schwartz', [(0, 40), (165, 209), (362, 417), (550, 567), (761, 809), (881, 954), (1052, 1113), (27, 54), (195, 295), (482, 546), (707, 757), (906, 1003), (1080, 1126), (0, 33), (145, 229), (353, 408), (492, 561), (576, 640), (736, 766), (820, 870), (1094, 1163)])
  ('Foligno', [(0, 40), (176, 209), (362, 416), (552, 567), (761, 835), (883, 954), (459, 502), (546, 583), (757, 826), (1189, 1200), (0, 33), (212, 249), (353, 413), (575, 576), (696, 722), (722, 762)])
  </code></pre>
  
  <p>Here is the <code>Script</code> I have so far:</p>
  
  <pre><code>import csv
  from itertools import combinations, product
  
  #Header = LastName  StartTime  EndTime  Duration Period TeamAbbrev Position
  
  #Import Game
  with open('2017020397.csv', newline='') as f:
      next(f)
      skaters = '\n'.join(' '.join(row) for row in csv.reader(f))
      data = skaters.splitlines()
  
  def to_secs(ms):
      ''' Convert a mm:ss string to seconds '''
      m, s = map(int, ms.split(':'))
      return 60 * m + s
  
  # Store a list of (start, end) times for each player
  players = {}
  for row in data:
      name, start, end = row.split(None, 3)[:3]
      times = to_secs(start), to_secs(end)
      players.setdefault(name, []).append(times)
  
  for t in players.items():
      print(t)
  
  outfile = open("ShiftData.csv","a",newline='')
  writer = csv.writer(outfile)
  writer.writerow(["Player","Shift1"])
  writer.writerow([name, times])
  outfile.close()
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Player  Shift1
  Dumba   (39, 39)
  </code></pre>
  
  <p>The <code>output</code> is the last data not the Whole file. Also i would like all of the shifts to <code>output</code> in there own <code>cell</code>. <code>Example:</code></p>
  
  <pre><code>Player        Shift1       Shift2      Shift3       Shift4
  Bouwmeester   (0, 37)    (155, 194)  (327, 420)   (541, 602)
  </code></pre>