SHARE
TWEET

Untitled

a guest Jul 21st, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top