Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

get top elements from a list python

import numpy as np

top_2_idx = np.argsort(a)[-2:]
top_2_values = [a[i] for i in top_2_idx]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #top #elements #list #python
ADD COMMENT
Topic
Name
2+9 =