np.vecotrize()
函数还是很常用的,但是其中signature这个方法使用频率低。没啥靠谱的中文解释,这里记录一下。
1. numpy.vectorize() 基本介绍
a. 命令形式:
class numpy.vectorize(pyfunc, otypes=None, doc=None, excluded=None, cache=False, signature=None )
b. 官方文档的定义:
Define a vectorized function which takes a nested sequence of objects
or numpy arrays as inputs and returns a single numpy array or a tuple
of numpy arrays. 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.
np.vecotrize(pyfunc)
定义一个向量化的函数(pyfunc),使得数组可以作为输入, 并返回数组作为输出。向量化的函数(pyfun