This is a follow up question to get first and last values in a groupby
How do I drop first and last rows within each group?
I have this df
df
I'd apply a similar technique to what I did for the other question:
def first_last(df): return df.ix[1:-1] df.groupby(level=0, group_keys=False).apply(first_last)