I have a dataframe
| cycle_end_date | mid_cycle | Total | 0 | 1 | 2 | 3 |
|---|---|---|---|---|---|---|
| 15th Sept | 230 | 600 | 100 | 200 | 50 | 10 |
I want to transpose this dataframe such as:
| cycle_end_date | mid_cycle | Total | Delay | new_col |
|---|---|---|---|---|
| 15th Sept | 230 | 600 | 0 | 100 |
| 15th Sept | 230 | 600 | 1 | 200 |
| 15th Sept | 230 | 600 | 2 | 50 |
| 15th Sept | 230 | 600 | 3 | 10 |
Basically, the columns day0 , day1, day2 will become rows which will come under mid_cycle and total_amt, pending_amt will get distributed accordingly.
How do we achieve this? .transpose() is not giving me the desired results.