Just in case I misunderstood, why don't you make a little example of before and after the grouping? This mailing list does not accept attachments, so you'll have to make do with pasting a few rows of comma-separated or tab-separated values.
On Fri, May 13, 2016 at 3:56 PM Michael Selik <michael.se...@gmail.com> wrote: > In order to preserve your index after the aggregation, you need to make > sure it is considered a data column (via reset_index) and then choose how > your aggregation will operate on that column. > > On Fri, May 13, 2016 at 3:29 PM David Shi <davidg...@yahoo.co.uk> wrote: > >> Hello, Michael, >> >> Why reset_index before grouping? >> >> Regards. >> >> David >> >> >> On Friday, 13 May 2016, 17:57, Michael Selik <michael.se...@gmail.com> >> wrote: >> >> >> >> >> On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list < >> python-list@python.org> wrote: >> >> I lost my indexes after grouping in Pandas. >> I managed to rest_index and got back the index column. >> But How can I get back a index row? >> >> >> Was the grouping an aggregation? If so, the original indexes are >> meaningless. What you could do is reset_index before the grouping and when >> you aggregate decide how to handle the formerly-known-as-index column (min, >> max, mean, ?). >> >> >> -- https://mail.python.org/mailman/listinfo/python-list