I have list of lists like such:
[[person_a,code_1],[person_a,code_2],[person_a,code_3],[person_b,code_1],[person_b,code_1],[person_b,code_1],[person_a,code_4],[person_b,code_2]...]
I would like the achieve the following:
code_1 code_2 code_3 code_4
person a .2500 .2500 .2500 .2500
person b .6667 .3333 0.0 0.0
I've used prop.table
in R to achieve this before but am wondering if there is a Python equivalent. I can convert my list of list to a dataframe, what I'm interested in is some function that can generate each persons code proportions.