Pandas add calculated row to bottom of dataframe
Below is a small sample of a dataframe that I have and I want to add a calculated row to the bottom of it:
sch q1 q2 q3
acc Yes Yes No
acc Yes No No
acc Yes No No
acc Yes Yes Yes
I want to add a line at the bottom that will give me the percentage of "Yes" values ββfor each column so that it looks like below.
sch q1 q2 q3
acc Yes Yes No
acc Yes No No
acc Yes No No
acc Yes Yes Yes
acc 1.00 0.5 0.25
Any help would be greatly appreciated.
+3
source to share
4 answers