Pandas reset index doesn't seem to work?

前端 未结 4 498
星月不相逢
星月不相逢 2020-12-08 10:52

I\'m not sure where I am astray but I cannot seem to reset the index on a dataframe.

When I run test.head(), I get the output below:

4条回答
  •  自闭症患者
    2020-12-08 11:17

    I would add to in code veritas's answer:

    If you already have an index column specified, then you can save the del, of course. In my hypothetical example:

        df_total_sales_customers = pd.DataFrame({'Sales': total_sales_customers['Sales'],
                                  'Customers': total_sales_customers['Customers']}, index = total_sales_customers.index)
    
        df_total_sales_customers = df_total_sales_customers.reset_index()
    

提交回复
热议问题