Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. # Change this with whatever function you want for grouping
  4. def grouping(line):
  5. return int(line) // (24 * 3600 * 1000)
  6.  
  7. histo = {}
  8. with open('some_file.csv', 'r') as file:
  9. for line in file.readlines():
  10. key = grouping(line)
  11. histo[key] = histo.get(key, 0) + 1
  12.  
  13. for k, v in histo.items():
  14. print('{},{}'.format(k,v))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement