Hi,
I want to handle ties while getting top N elements in a list in python and I want include duplicates also if it matches the top value
For example
[1,2,2,4,5,5,6,10] I have a list like this
temp = np.partition(-test, 3)
>>> result = -temp[:3]
>>> result
array([ 6, 10, 5]) gives me top 3 values which 10,6,5
but actually top 3 values in the list are 10,6,5,5
Thanks,
Anusha
I want to handle ties while getting top N elements in a list in python and I want include duplicates also if it matches the top value
For example
[1,2,2,4,5,5,6,10] I have a list like this
temp = np.partition(-test, 3)
>>> result = -temp[:3]
>>> result
array([ 6, 10, 5]) gives me top 3 values which 10,6,5
but actually top 3 values in the list are 10,6,5,5
Thanks,
Anusha