>>> vfunc = np.vectorize(myfunc)
>>> vfunc([1, 2, 3, 4], 2)
array([3, 4, 1, 2])
import numpy as np
def myfunc(a):
# Return True if a>b, otherwise False"
if a > 2:
return bool(True)
else: return bool(False)
vfunc = np.vectorize(myfunc) # vectorize iterates function.
vfunc([1, 2, 3, 4])
# array([False, False, True, True])