Automate report in datewise using python pandas

129 Views Asked by At

I am working on an automation task and my dataframe columns are as shown below

Input

Code:

df = pd.read_excel('Input.xlsx', sheet_name='Sheet 1')

df = pd.pivot_table(df, index=['Employee Name'], 
                    values='Date',fill_value=None,
                    dropna=True, margins=False)

print(df.columns.to_list())

df = df.reset_index()

Calculations in Output:

Calculation for Utilization in row:

Utilization = Total Hours/9 * 100

If Billable is 'Yes' then it calculate the Billable

Calculation for Billing in row:

Billable = df[Billing] * Hours/9 * 100

If Billable is 'No' then it calculate the Non-Billable

Calculation for Non-Billing in row:

Non-Billable = df[Non-Billing] * Hours/ 9* 100

I want to generate a Output report as follows

Output

0

There are 0 best solutions below