select certain element from ndarray python

Solutions on MaxInterview for select certain element from ndarray python by the best coders in the world

showing results for - "select certain element from ndarray python"
Stella
06 Mar 2019
1# arr = [elements]
2# new_arr = arr[condition]  
3# new_arr = [lements satisfying condition]
4arr = [3, 6, 5, 9, 4, 12, 1]
5new_arr = arr[arr%2 == 0]
6new_arr = [6, 4, 12]