numpy.vectorize()

numpy.vectorize

class numpy.vectorize(pyfunc, otypes=None, doc=None, excluded=None, cache=False, signature=None) [source]

Generalized function class.

Define a vectorized function which takes a nested sequence of objects or numpy arrays as inputs and returns an single or tuple of numpy array as output. The vectorized function evaluates pyfunc over successive tuples of the input arrays like the python map function, except it uses the broadcasting rules of numpy.

The data type of the output of vectorized is determined by calling the function with the first element of the input. This can be avoided by specifying the otypes argument.

登录查看完整内容