Need to get output in the following format using pandas

Need to get output in the following format using pandas

I have data in a pandas dataFrame which is as below

I have data in a pandas dataFrame which is as below

    Employee ID                        Employee Name  Day 1  Day 2       ...  Day 30  Day 31
0       1                              EMPLOYEE1       8.75   8.75       ...    8.75    8.75 
1       2                              EMPLOYEE2       0.00   8.00       ...    8.00    8.00

I need my output as follows:

1  Day 1  EMPLOYEE1 8.75
1  Day 2  EMPLOYEE1 8.75
.
.
1  Day 31 EMPLOYEE1 8.75
2  Day 1  EMPLOYEE2 0.00
2  Day 2  EMPLOYEE2 8.00
.
.
2  Day 31 EMPLOYEE2 8.00

This is the code

# Copy ID and Name to new dataFrame

df_EID = df[['Employee ID', 'Employee Name']].copy()

transpose the and copy the original dataframe to a new one

df_transpose = df.transpose()

make necessary changes to the transpose so that the column headers are the

Employee IDs and also delete the first index which has those IDs

df_transpose = df_transpose.rename(columns=df_transpose.iloc[0]) df_transpose.drop(df_transpose.index[0])

run Query to check just for the first employee

df_transpose[df_EID['Employee ID'][0:]]

#iterate

Expected Result

1  Day 1  EMPLOYEE1 8.75
1  Day 2  EMPLOYEE1 8.75
.
.
1  Day 31 EMPLOYEE1 8.75
2  Day 1  EMPLOYEE2 0.00
2  Day 2  EMPLOYEE2 8.00
.
.
2  Day 31 EMPLOYEE2 8.00
.
.

Actual Result

                           1       ...                     100
Employee ID                1       ...                     100
Employee Name      EMPLOYEE1       ...             EMPLOYEE100
Day 1                   8.75       ...                    8.75
.
.
.

Day 30 8.75 ... 8.75 Day 31 8.75 ... 8.75 Total Hours 188.25 ... 191.5

It seems I am actually going back to square one. Can you please help me on this? Can you also point out where I went wrong in my approach too? Thanks in advance. It would also be better if I put the output to another dataframe so I can write it to excel the same way as the expected output

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Python Pandas Tutorial - Data Analysis with Python Pandas

Python Pandas Tutorial - Data Analysis with Python Pandas will help you get started with Python Pandas Library for various applications including Data analysis. You'll learn: Introduction to Pandas; DataFrames and Series; How To View Data? Selecting Data; Handling Missing Data; Pandas Operations; Merge, Group, Reshape Data; Time Series And Categoricals; Plotting Using Pandas

Python Pandas Tutorial - Data Analysis with Python Pandas

Python Pandas Tutorial will help you get started with Python Pandas Library for various applications including Data analysis. Introduction to Pandas. DataFrames and Series. How To View Data? Selecting Data. Handling Missing Data. Pandas Operations. Merge, Group, Reshape Data. Time Series And Categoricals. Plotting Using Pandas

Top Python Development Companies | Hire Python Developers

After analyzing clients and market requirements, TopDevelopers has come up with the list of the best Python service providers. These top-rated Python developers are widely appreciated for their professionalism in handling diverse projects. When...