Linked Questions

Popular Questions

My data has the following shape:

id   column1   column2
a    x         1
a    x         3
a    y         3
b    y         1
b    y         2

And I want to get to most repeated value for each id as well as its frequency percentage.

id   column1  %     column2  %
a    x        66.6  3        66.6
b    y        100.0 N/A      N/A

a special case is when there are equal frequencies, I output N/A for both column and percentage.

Right now my solution is purely using python dictionaries and lists. However, I am struggling to approach this from a DataFrame point of view

Related Questions