-3

Input Data enter image description here

Output: enter image description here

  1. I want to get the ratio of ( type A / (Type A + Type B) for each time and person. If the same time has multiple same type entries then we add the value together for that entry.

For example: In Time 1 John => 1 / (1 + 2) = .33

I am trying to find the ratio of the sum for each person at a different time.

I think this can be done using the group by and pivot table.

Thank you in advance for your help.

  • [Please do not use images or screenshots](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors-when-asking-a-question) but paste your code and data as text instead. And do share the codes you have tried in a [minimal and reproducible manner](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). – greco May 05 '22 at 01:42

0 Answers0