title: How to group DataFrame by a period of time?
body: <p>I have some data from log files and would like to group entries by a minute:</p>
  
  <pre><code> def gen(date, count=10):
       while count &gt; 0:
           yield date, "event{}".format(randint(1,9)), "source{}".format(randint(1,3))
           count -= 1
           date += DateOffset(seconds=randint(40))
  
   df = DataFrame.from_records(list(gen(datetime(2012,1,1,12, 30))), index='Time', columns=['Time', 'Event', 'Source'])
  </code></pre>
  
  <p>df:</p>
  
  <pre><code> Event  Source
   2012-01-01 12:30:00     event3  source1
   2012-01-01 12:30:12     event2  source2
   2012-01-01 12:30:12     event2  source2
   2012-01-01 12:30:29     event6  source1
   2012-01-01 12:30:38     event1  source1
   2012-01-01 12:31:05     event4  source2
   2012-01-01 12:31:38     event4  source1
   2012-01-01 12:31:44     event5  source1
   2012-01-01 12:31:48     event5  source2
   2012-01-01 12:32:23     event6  source1
  </code></pre>
  
  <p>I tried these options:</p>
  
  <ol>
  <li><code>df.resample('Min')</code> is too high level and wants to aggregate.</li>
  <li><code>df.groupby(date_range(datetime(2012,1,1,12, 30), freq='Min',
  periods=4))</code> fails with exception.</li>
  <li><p><code>df.groupby(TimeGrouper(freq='Min'))</code> works fine and returns a <code>DataFrameGroupBy</code> object for further processing, e.g.:</p>
  
  <pre><code>grouped = df.groupby(TimeGrouper(freq='Min'))
  grouped.Source.value_counts()
  2012-01-01 12:30:00  source1    1
  2012-01-01 12:31:00  source2    2
                       source1    2
  2012-01-01 12:32:00  source2    2
                       source1    2
  2012-01-01 12:33:00  source1    1
  </code></pre></li>
  </ol>
  
  <p><em>However</em>, the <code>TimeGrouper</code> class is not documented.</p>
  
  <p>What is the correct way to group by a period of time? How can I group the data by a minute AND by the Source column, e.g. <code>groupby([TimeGrouper(freq='Min'), df.Source])</code>?</p>