Answers for "find closest integer in array python"

0

find the closest smaller value in an array python

>>> # the smallest element of myArr greater than myNumber
>>> myArr[myArr > myNumber].min()  
44

>>> # the largest element of myArr less than myNumber
>>> myArr[myArr < myNumber].max()
4
Posted by: Guest on June-26-2020

Code answers related to "find closest integer in array python"

Python Answers by Framework

Browse Popular Code Answers by Language