title: python Samples of a Dataframe, like pandas Dataframe.sample() but always selecting n adjacent values
body: <p>I would like to split my Dataframe into train and test, but the test set should contain for example 3 adjacent rows from the whole data multiple times. I dont know how to write the Question properly, please just look at the tables. I want to split my Dataframe by blocks.</p>
  <p>All Data:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Y</th>
  <th>row_num</th>
  <th>x1</th>
  <th>x2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>value</td>
  <td>1</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>2</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>3</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>4</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>5</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>6</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>7</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>8</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>9</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>10</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>11</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>What I want:</p>
  <p>train:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Y</th>
  <th>row_num</th>
  <th>x1</th>
  <th>x2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>value</td>
  <td>1</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>5</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>6</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>10</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>11</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>test:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Y</th>
  <th>row_num</th>
  <th>x1</th>
  <th>x2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>value</td>
  <td>2</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>3</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>4</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>7</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>8</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  <tr>
  <td>value</td>
  <td>9</td>
  <td>some value</td>
  <td>some other value</td>
  </tr>
  </tbody>
  </table>
  </div>