Skip to content

Instantly share code, notes, and snippets.

@thejeshgn
Created February 17, 2014 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thejeshgn/9046185 to your computer and use it in GitHub Desktop.
Save thejeshgn/9046185 to your computer and use it in GitHub Desktop.
Hourly histogram of incoming calls
from datetime import datetime
from datetime import timedelta
diff_time_from_gmt = timedelta(minutes=330)
incoming = []
with open('/home/thej/Desktop/my_incoming_calls.csv', 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter='\t', quotechar='|')
for row in spamreader:
incoming.append( ( datetime.strptime(row[4], '%Y-%m-%d %H:%M:%S')+ diff_time_from_gmt ))
pyplot.hist([t.hour + t.minute/60. for t in incoming] , bins=24, facecolor='green', alpha=0.75)
pyplot.xlabel('By Hour')
pyplot.ylabel('Count')
pyplot.title(r'Calls')
pyplot.grid(True)
pyplot.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment