How to put back a number-based index

David Shi davidgshi at yahoo.co.uk
Fri May 13 15:22:14 EDT 2016


Hello, Michael,Thank you.  Yes, aster grouping I lost my indexing in both x, y directions.
How to convert a row, and a column into indexes or labels? 

    On Friday, 13 May 2016, 17:57, Michael Selik <michael.selik at gmail.com> wrote:
 

 

On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list <python-list at 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, ?).

  


More information about the Python-list mailing list