Pandas group by chunks not single values
<p>Now I'm kinda confused about grouping stuff using pandas.</p>

<p>I have set of data (over 60k rows) with 3 columns:</p>

<pre><code>2015/12/18 11:12:49 +0300   d1  b1
2015/12/18 11:12:50 +0300   d2  b2
2015/12/18 11:13:08 +0300   d1  b3
2015/12/18 11:13:36 +0300   d2  b4
2015/12/18 11:13:43 +0300   d2  b5
2015/12/18 11:14:21 +0300   d2  c0
2015/12/18 11:14:42 +0300   d2  c1
2015/12/18 11:15:13 +0300   d1  c2
2015/12/18 11:15:19 +0300   d3  c3
</code></pre>

<p>And I need to get count of rows grouped by time periods (let's say 0-4, 4-8, 8-12 etc. by 4 hours) and weekdays and then get a single set for periods within a week.</p>

<p>I can get sum for every hour in a week (time is the name of 1st column):</p>

<pre><code>dind = pd.DatetimeIndex(df.time)
gr = df.groupby([dind.weekday, dind.hour])
gr.size()
</code></pre>

<p>But I can't figure out how to group by chunks and then merge resulting <code>MultiIndex</code> into single index column.</p>

<p>I hope it was clear description of the problem.</p>