title: Random blocks of data in Pandas
body: <p>I need to get random blocks of data from my data frame <code>df</code>.  I have tried using <code>df.sample(10)</code>, but it only generates individual samples, and not contiguous blocks.  Is there a way to sample random blocks (for instance, blocks of 6 continuous data points)?</p>
  
  <p>Here is a sample of the data frame </p>
  
  <pre><code>Year_DoY_Hour
  2015-11-20 12:00:00         NaN
  2015-11-20 12:30:00         NaN
  2015-11-20 13:00:00         NaN
  2015-11-20 13:30:00         NaN
  2015-11-20 14:00:00         NaN
  2015-11-20 14:30:00         NaN
  2015-11-20 15:00:00    0.083298
    ...
  2016-04-30 13:00:00    0.055639
  2016-04-30 13:30:00    0.030809
  2016-04-30 14:00:00    0.079277
  2016-04-30 14:30:00    0.040736
  2016-04-30 15:00:00    0.066980
  2016-04-30 15:30:00    0.076448
  2016-04-30 16:00:00    0.066822
  2016-04-30 16:30:00    0.073143
  2016-04-30 17:00:00         NaN
  2016-04-30 17:30:00         NaN
  2016-04-30 18:00:00         NaN
  2016-04-30 18:30:00         NaN
  2016-04-30 19:00:00         NaN
  2016-04-30 19:30:00         NaN
  </code></pre>
  
  <p>So from <code>df</code> I need to create 3 randomly chosen blocks with 6 lines.</p>
  
  <p>Example:</p>
  
  <p>block1</p>
  
  <pre><code>2016-04-30 15:00:00    0.066980
  2016-04-30 15:30:00    0.076448
  2016-04-30 16:00:00    0.066822
  2016-04-30 16:30:00    0.073143
  2016-04-30 17:00:00         NaN
  2016-04-30 17:30:00         NaN
  </code></pre>
  
  <p>block2</p>
  
  <pre><code>2016-04-30 09:30:00    0.036728
  2016-04-30 10:00:00    0.036108
  2016-04-30 10:30:00    0.031045
  2016-04-30 11:00:00    0.031762
  2016-04-30 11:30:00    0.033714
  2016-04-30 12:00:00    0.042499
  </code></pre>
  
  <p>block3</p>
  
  <pre><code>2015-11-20 04:30:00         NaN
  2015-11-20 05:00:00         NaN
  2015-11-20 05:30:00         NaN
  2015-11-20 06:00:00         NaN
  2015-11-20 06:30:00         NaN
  2015-11-20 07:00:00         NaN
  </code></pre>
  
  <p>Where the blocks should be in random order, but the data within the blocks must be in sequence. I have not found any function or anything like that to do this. </p>