Before writing my output dataframe to an excel file, I need to add an extra row to my dataframe. Below is my example dataframe:
-----------------------------
| Col1 | Col2 | Col3 | Col4 |
-----------------------------
0 | CA1 | CB1 | CC2 | CD1 |
1 | CA5 | CB5 | CC5 | CD5 |
2 | CA3 | CB3 | CC3 | CD3 |
-----------------------------
mydict= {'Col1': 'P', 'Col2': 'Q', 'Col3': 'R', 'Col4': 'S'}
Now I need to add an extra row where new row values should be picked from mydict corresponding to column header.
Desired Output:
-----------------------------
| Col1 | Col2 | Col3 | Col4 |
-----------------------------
| P | Q | R | S |
0 | CA1 | CB1 | CC2 | CD1 |
1 | CA5 | CB5 | CC5 | CD5 |
2 | CA3 | CB3 | CC3 | CD3 |
-----------------------------
Can anyone please help.