title: Efficient Partitioning of Pandas DataFrame rows between sandwiched indicator variables
body: <p>Suppose I have a pandas df with an indicator row that sandwiches a period. Ex. </p>
  
  <pre><code>In [9]: pd.DataFrame({'col1':np.arange(1,11),'indicator':[0,1,0,0,0,1,0,0,1,1]})
  Out[9]: 
     col1  indicator
  0     1          0
  1     2          1
  2     3          0
  3     4          0
  4     5          0
  5     6          1
  6     7          0
  7     8          0
  8     9          1
  9    10          1
  </code></pre>
  
  <p>What I want to do, is to use groupby to select the partitions separated by the indicators. </p>
  
  <p>ex. </p>
  
  <p>Group 1</p>
  
  <pre><code>col1  indicator
  0     1          0
  1     2          1
  </code></pre>
  
  <p>Group 2</p>
  
  <pre><code>2     3          0
  3     4          0
  4     5          0
  5     6          1
  </code></pre>
  
  <p>Group 3</p>
  
  <pre><code>6     7          0
  7     8          0
  8     9          1
  </code></pre>
  
  <p>Group 4</p>
  
  <pre><code>9    10          1
  </code></pre>
  
  <p>The naive solution will be to just take the indicator column out as a list, run a for-loop through it, and just label each part. But suppose the dataset is really big, and you want to avoid the for-loop. Is there something more clever that can be done here, to separate out the different groups? </p>
  
  <p>Thanks! </p>