find the closest smaller value in an array python

Solutions on MaxInterview for find the closest smaller value in an array python by the best coders in the world

showing results for - "find the closest smaller value in an array python"
Yoann
03 Oct 2019
1>>> # the smallest element of myArr greater than myNumber
2>>> myArr[myArr > myNumber].min()  
344
4
5>>> # the largest element of myArr less than myNumber
6>>> myArr[myArr < myNumber].max()
74