Created
February 17, 2014 07:22
-
-
Save thejeshgn/9046185 to your computer and use it in GitHub Desktop.
Hourly histogram of incoming calls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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