Python Forum
Extract the largest value from a group without replacement (beginner) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Extract the largest value from a group without replacement (beginner) (/thread-28972.html)



Extract the largest value from a group without replacement (beginner) - preliator - Aug-12-2020

I have a dataframe that represents different combinations of people (11 people in total), with a score per combination ranging from 0 (bad) to 20 (very good):

nom_combinaison; personnes; score_combinaison_sur_20
combi1           personne1  18
combi1           personne2  18
combi2           personne2  4
combi2           personne3  4
combi3           personne1  14
combi3           personne3  14
...       ; ...
I would like to find a way to extract the combinations that have the best score while being careful not to take the same person several times. I have tried several methods with research on the internet, unfortunately without results. Is it possible to do this?

Thank you.


RE: Extract the largest value from a group without replacement (beginner) - DPaul - Aug-12-2020

So we understand this, what would be the correct result
for the 6 lines you are showing ?

Paul