Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108605

Re: How to put back a number-based index

From Michael Selik <michael.selik@gmail.com>
Newsgroups comp.lang.python
Subject Re: How to put back a number-based index
Date 2016-05-13 16:56 +0000
Message-ID <mailman.635.1463158627.32212.python-list@python.org> (permalink)
References <1878444350.3064027.1463156091513.JavaMail.yahoo.ref@mail.yahoo.com> <1878444350.3064027.1463156091513.JavaMail.yahoo@mail.yahoo.com> <1974768074.3081564.1463156374539.JavaMail.yahoo@mail.yahoo.com> <CAGgTfkNC=aCkp+6TY3LxYe-EK5Ug64L-Qua_qVS70qPpfbbtvA@mail.gmail.com>

Show all headers | View raw


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, ?).

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to put back a number-based index Michael Selik <michael.selik@gmail.com> - 2016-05-13 16:56 +0000

csiph-web