Skip to content
Advertisement

“How to consolidate Values present in Unique Rownames” and add a row containing their Sum

I want to append 2 Rows (Yes/No) for Each Unique Session name.

Eg: Take 1st Session
I want to Add 2 Rows Yes and No which comprises of values as stated below

Yes -> “On Duty + Attended + Online Prescence” => 25+30+40 = 95
No -> “Did Not Attend => 10.

Is there any way to do it in Python.

My input is given below

`First Level

—————————————

My Final output Should Look like thisFinal Level

Advertisement

Answer

Here is an idea via dplyr with only fault that the Yes and No appear at the top of each group,

JavaScript

which gives,

JavaScript

DATA:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement