0

I generate the following DataFrame by my optimization Results, using multiindex:

    hour         0       1        2
Scenario plant          
0        A       0,0831  0,08124  0,08124
         B       0,5     0,5      0,5
         C       0,4599  0,31246  0,16786
         D       0       0        0

But since I might want to transform it in Excel in a Pivot-Table, it would be better to have the index "Scenario" in every row like:

    hour         0       1        2
Scenario plant          
0        A       0,0831  0,08124  0,08124
0        B       0,5     0,5      0,5
0        C       0,4599  0,31246  0,16786
0        D       0       0        0

Does anyone know how to solve this problem?

Christian P
  • 83
  • 2
  • 12
  • You can just use `.rest_index()` – Dan Jun 21 '18 at 09:04
  • Possible duplicate of [Pandas reset index on series to remove multiindex](https://stackoverflow.com/questions/18624039/pandas-reset-index-on-series-to-remove-multiindex) – koPytok Jun 22 '18 at 06:55

1 Answers1

1

Worked as stated in the comments with .reset_index()

Christian P
  • 83
  • 2
  • 12