``` >>> df = pd.DataFrame(np.random.randint(1, 9, (2, 3)), columns=['jim', 'joe', 'jolie']) >>> df jim joe jolie 0 4 7 8 1 7 8 3 >>> ts = df['joe'] * 0 >>> ts.name 'joe' >>> gr = df.groupby(ts) >>> gr.nth(0) # this invokes _set_selection_from_grouper internally jim jolie joe 7 4 8 >>> gr.apply(sum) # joe column is gone jim jolie joe 0 11 11 ``` whereas: ``` >>> df.groupby(ts).apply(sum) jim joe jolie joe 0 11 15 11 ``` What happens is that [this line](https://github.com/pydata/pandas/blob/35a95274bcc90e1a44a881aac2e0183663272fc2/pandas/core/groupby.py#L474) removes the column from selection if it has the same name as the grouper.