title: Count number of records by datetime interval
body: <p>I have some data loaded into a <code>Pandas</code> <code>DataFrame</code> that I want to aggregate into datetime intervals and count the number of records within each interval.  The thing is that the method that I found to aggregate into datetime intervals and count the number of records within each interval seems fairly clunky, and maybe not the most efficient.  It's also a pain to change the interval that I want to group by to count the number of tweets. </p>
  
  <pre><code>data = [[Timestamp('2016-10-26 18:47:53'), 'mention'],
          [Timestamp('2016-10-26 20:28:35'), 'retweet'],
          [Timestamp('2016-10-26 20:57:38'), 'tweet'],
          [Timestamp('2016-10-26 21:36:37'), 'mention'],
          [Timestamp('2016-10-26 22:49:08'), 'tweet'],
          [Timestamp('2016-10-27 00:10:19'), 'tweet'],
          [Timestamp('2016-10-27 01:14:46'), 'tweet'],
          [Timestamp('2016-10-27 01:45:03'), 'retweet'],
          [Timestamp('2016-10-27 02:33:03'), 'tweet'],
          [Timestamp('2016-10-27 05:55:52'), 'retweet'],
          [Timestamp('2016-10-27 14:26:57'), 'mention'],
          [Timestamp('2016-10-27 17:46:42'), 'tweet'],
          [Timestamp('2016-10-27 17:53:33'), 'retweet'],
          [Timestamp('2016-10-27 18:53:38'), 'tweet'],
          [Timestamp('2016-10-27 21:02:00'), 'retweet'],
          [Timestamp('2016-10-27 21:23:50'), 'retweet'],
          [Timestamp('2016-10-27 22:21:01'), 'retweet'],
          [Timestamp('2016-10-28 05:30:02'), 'retweet'],
          [Timestamp('2016-10-28 13:11:01'), 'retweet'],
          [Timestamp('2016-10-28 16:55:13'), 'retweet'],
          [Timestamp('2016-10-28 18:25:02'), 'retweet'],
          [Timestamp('2016-10-28 18:54:44'), 'retweet'],
          [Timestamp('2016-10-28 19:22:14'), 'tweet'],
          [Timestamp('2016-10-28 19:23:20'), 'tweet'],
          [Timestamp('2016-10-28 22:33:03'), 'tweet']]
  
  df = pd.DataFrame(data, columns=['datetime', 'type'])
  
  df['type'].groupby([df.datetime.dt.month, df.datetime.dt.day,df.datetime.dt.hour]).count().plot(kind="line")
  </code></pre>
  
  <p>Bonus points if you can also help me to figure out how to break out 'type' into 3 separate lines! :)</p>