Monday, February 7, 2011

Python code for making a histogram of your e-mail volume

Here is the source code for the example in my last post. I haven't had time to clean it up, and some parts are not very elegant. But if you want to try it out with your own inbox, all you need to do is change the e-mail address and run it.

Three caveats:
1. If you need to download a large number of e-mail headers, it will take some time (maybe several minutes).
2. It sometimes gets the dates wrong. However, this seems to occur only in a statistically insignificant fraction of cases.
3. Running this will mark all the messages it accesses as read. I'm sure there's a way to avoid this, but haven't had time to track it down.

Sunday, February 6, 2011

Visualizing my inbox load

The other day I happened to notice that I had received well over 100 e-mails in one day.  While that may or may not seem high to you, in my case this meant that I spent most of the day handling e-mails, since the majority of these actually required a response or some other action on my part (I'm organizing two workshops right now, which accounts for much of the traffic).

I thought back to grad school days when I might or might not receive any e-mail on a given day.  When did it all get so crazy?  I decided it would be fun to find out.  A bit of searching turned up the Python package imaplib, which allowed me to download headers for all messages (ever!) from my Gmail account.  Then it was just a matter of extracting and reformatting the dates and plotting up a histogram with matplotlib.  Here's the result:


Can you tell when I graduated and started working for KAUST?  In the last few months prior to starting at KAUST, I got an average of about 250 messages a month.  Within 2 months of starting at KAUST, that average was well over 1000, with some months substantially higher.  Ah, the joys of being a professor...