Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #!/usr/bin/python
  2. from datetime import datetime
  3. import sys
  4. import csv
  5. import re
  6.  
  7. reader = csv.reader(sys.stdin, delimiter = "\t")
  8.  
  9. for line in reader:
  10. date = line[0]
  11. weekday = weekday = datetime.strptime(date, "%Y-%m-%d").weekday()
  12. print "{0}\t{1}".format(weekday,line[4])
  13.  
  14. #!/usr/bin/python
  15.  
  16. import sys
  17. count = 0
  18. total = 0.00
  19. nodeList = []
  20. for line in sys.stdin:
  21. smallData = ""
  22. data_mapped = line.strip().split("\t", 1)
  23. if len(data_mapped) != 2:
  24. continue
  25. thisKey, thisContent = data_mapped
  26. if thisKey == "0":
  27. count = count +1
  28. total = total + float(thisContent)
  29. print total/count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement