How to get a specific elements from a list using numpy in Python

1 Answer

0 votes
import numpy as np 

lst = [4, 7, 12, 6, 98, 43, 77, 89, 99, 100, 103]

arr =  np.take(lst, [1, 2, 5, 9])

print(arr)

     
    
'''
run:
  
[  7  12  43 100]
    
'''

 



answered Feb 26, 2020 by avibootz
...