title: Pandas DataFrame groupby overlapping intervals of variable length
body: <p>I am trying to group a DataFrame by 2 columns (see example below). 
  For the first column, I want each value to belong to a group. For the second column, I want to group by overlapping intervals of unequal size. </p>
  
  <p>My understanding is that pd.cut() only allows me to group by non-overlapping intervals. </p>
  
  <p>Here is an example:</p>
  
  <pre><code>    0   1   2
  0   0   4   1721
  1   0   5   2353
  2   0   6   58
  3   0   7   524
  4   1   1   1934
  5   1   2   1318
  6   1   2   1307
  7   1   2   301
  8   1   2   502
  9   1   3   996
  10  1   3   32
  </code></pre>
  
  <p>By grouping by column 0 and 1 I want:</p>
  
  <pre><code>0  1    2
  0 [4,5] [1721,2353]
    [5,6] [2353,58]
    [6,7] [58,524]
  1 [1,2] [1934,1318,1307,301,502]
    [2,3] [1318,1307,301,502,996,32]
  </code></pre>
  
  <p>I would then take mean or std of column 2. Any suggestion? Thanks ! </p>