I need to combine both records into single record. I have a Billable column value as 'Yes' and 'No'
If Value is 'Yes' then it will sum row-wise and created new columns as 'Billable'
Billing = df[Billing] * sum/168 * 100
If value is 'No' then it will be sum row-wise and created new column as 'Non-Billable'.
Non-Billing = df[Non-Billing] * sum/ 168 * 100
Data:
|Employee Name | Java | Python | .Net | React | Billable|
|Priya | 10 | | 5 | | Yes |
|Priya | | 10 | | 5 | No |
|Krithi | | 10 | 20 | | No |
Output
Priya is in both billable and non-billable, priya name appears in two rows. I need to merge in single row with Employee Name. So expected output should be
| Employee Name | Java | Python |.Net | React | Total |Billing | Non-Billing|
| Priya | 10 | 10 | 5 | 5 | 30 |8.928571429 | 8.928571429|
| Krithi | 10 | 20 | | | 30 | | 17.85714286|
Expected Output billable and non-billable data should be in single row.
But I am getting output in two rows Billable and Non-Billable
total=df.sum(axis=1)
df.insert(len(df.columns),column='Total',value=total)
x = (Billable_cal.loc[:,:].sum(axis=1)/available*100).round(2)
df["Billing"] = np.where(df["Billable"] == "Yes", x, "")
df["Non Billing"] = np.where(df["Billable"] == "No", x, "")