Advertisement
n8henrie

Who is on the same rotation as me?

May 1st, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.51 KB | None | 0 0
  1. #!/usr/local/bin/python
  2. import csv
  3. import pprint
  4.  
  5. reader = list(csv.reader(open('/Users/username/Desktop/All.csv', 'rb')))
  6.  
  7. #outputall = []
  8. outputall = {}
  9.  
  10. dates = [ '6/25/2013', '7/2/2013', '7/9/2013', '7/16/2013', '7/23/2013', '7/30/2013', '8/6/2013', '8/13/2013', '8/20/2013', '8/27/2013', '9/3/2013', '9/10/2013', '9/17/2013', '9/24/2013', '10/1/2013', '10/8/2013', '10/15/2013', '10/22/2013', '10/29/2013', '11/5/2013', '11/12/2013', '11/19/2013', '11/26/2013', '12/3/2013', '12/10/2013', '12/17/2013', '12/24/2013', '12/31/2013', '1/7/2014', '1/14/2014', '1/21/2014', '1/28/2014', '2/4/2014', '2/11/2014', '2/18/2014', '2/25/2014', '3/4/2014', '3/11/2014', '3/18/2014', '3/25/2014', '4/1/2014', '4/8/2014', '4/15/2014', '4/22/2014', '4/29/2014', '5/6/2014', '5/13/2014', '5/20/2014', '5/27/2014', '6/3/2014', '6/10/2014', '6/17/2014', '6/24/2014' ]
  11.  
  12. for date in dates:
  13.     outputall.setdefault(date, [])
  14.  
  15. for row in reader:
  16.     x = 0
  17.     for column in row:        
  18.         if (column == reader[5][x] and row.index(column) > 3
  19.         and row[0] != 'Lastname, Firstname'):
  20.             key = str(reader[0][x])
  21.             value = '{0}: {1}'.format(row[2], row[0])
  22.             outputall[key].append(value)
  23.  
  24. #            output = '{0}\t{1}: {2}'.format(reader[0][x], row[2], row[0])
  25. #            outputall.append(output)
  26.         x += 1
  27.  
  28. for date, who in outputall.iteritems():
  29. #    pprint.pprint(outputall)
  30.     print '{0}:\t{1}'.format(date, '. '.join(who))
  31.    
  32. #outputall.sort()
  33. #print '\r'.join(outputall)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement