There are several useful methods that were not explored from the list in step 2. Take for instance the nth method, which, when given a list of integers, selects those specific rows from each group. For example, the following operation selects the first and last rows from each group:
>>> grouped.nth([1, -1]).head(8)