I have a pandas groupby data frame that looks like the below and is grouped on `page`:

```
+---------+------+-------+
|  page   | hour | count |
+---------+------+-------+
| 3727441 |    1 |  2003 |
| 3727441 |    2 |   654 |
| 3727441 |    3 |  5434 |
| 3727458 |    1 |   326 |
| 3727458 |    2 |  2348 |
| 3727458 |    3 |  4040 |
| 3727458 |    4 |   374 |
| 3727458 |    5 |  2917 |
| 3727458 |    6 |  3937 |
| 3735634 |    1 |  1957 |
| 3735634 |    2 |  2398 |
| 3735634 |    3 |  2812 |
| 3768433 |    1 |   499 |
| 3768433 |    2 |  4924 |
| 3768433 |    3 |  5460 |
| 3768433 |    4 |  1710 |
| 3768433 |    5 |  3877 |
| 3768433 |    6 |  1912 |
| 3768433 |    7 |  1367 |
| 3768433 |    8 |  1626 |
| 3768433 |    9 |  4750 |
+---------+------+-------+

```

You will notice that some of the groups have 3, 6 or 9 rows as counted by the hours. What I would like to do is slice each group down to 3 hours max and append something to the 6 and 9 length groups to denote that it is the same page like the following:

```
+-----------+------+-------+
|   page    | hour | count |
+-----------+------+-------+
| 3727441   |    1 |  2003 |
| 3727441   |    2 |   654 |
| 3727441   |    3 |  5434 |
| 3727458   |    1 |   326 |
| 3727458   |    2 |  2348 |
| 3727458   |    3 |  4040 |
| 3727458_1 |    4 |   374 |
| 3727458_1 |    5 |  2917 |
| 3727458_1 |    6 |  3937 |
| 3735634   |    1 |  1957 |
| 3735634   |    2 |  2398 |
| 3735634   |    3 |  2812 |
| 3768433   |    1 |   499 |
| 3768433   |    2 |  4924 |
| 3768433   |    3 |  5460 |
| 3768433_1 |    4 |  1710 |
| 3768433_1 |    5 |  3877 |
| 3768433_1 |    6 |  1912 |
| 3768433_2 |    7 |  1367 |
| 3768433_2 |    8 |  1626 |
| 3768433_2 |    9 |  4750 |
+-----------+------+-------+

```

I attempted to do begin doing this with `enumerate`:

```
for name, group in hourly_groups:
        for i, x in enumerate(group):
            print x

```

but it isn't returning the right groups.

Also tried this below:

```
for k, g in df_hourly.groupby(df_hourly['page'] - 3):
    print g

```

---

Edit:

I truncated, my data thinking that it would be easier to understand, but the solutions given seem to not work on my actual data set. Here is a sample of the actual data set where page `3694750` is an example of a page that needs to be broken into groups of 34. <http://www.sharecsv.com/s/b2dbe8e49d6a2481de138f6ca06c679e/test.csv>