numpy高级应用—ufunc 1.内置ufunc方法 reduce方法 outer方法 accumulate方法 reduceat方法 2.自定义ufunc方法 frompyfunc方法 vectorize方法 1.内置ufunc方法 内置的ufunc方法的目的主要是免去了编写循环的代码。使用的形式为 "np.operation_name.ufunc" reduce方法 对相邻的两个数字进行聚合操作, import numpy as np np.multiply.reduce([2, 3, 5]) # 返回结果30 X = np.arange(8).reshape(2, 2, 2) # X的形式为 [[[0, 1], [2, 3]], [[4, 5], [6,