Universal functions operate elementwise on an array, producing an array as output.
# np.cos(a), np.sin(a), np.tan(a), # np.arccos(a), np.arcsin(a), np.arctan(a), # np.cosh(a), np.sinh(a), np.tanh(a), # np.arccosh(a), np.arcsinh(a), np.arctanh(a), # np.exp(a), np.sqrt(a), np.abs(a), np.sign(a), np.round(a), # np.log(a), np.log2(a), np.log10(a)
# np.sum(a, axis=k) - sum of array elements over a given axis # np.prod(a, axis=k) # np.cumsum(a, axis=k) # np.cumprod(a, axis=k) # np.min(a, axis=k) # np.max(a, axis=k) # np.argmin(a, axis=k) # np.argmax(a, axis=k)
# np.median(a, axis=k) - return the median (the middle value of a sorted copy of a) # np.average(a, axis=k, weights=w) - compute the weighted average # np.mean(a, axis=k) - compute the arithmetic mean # np.var(a, axis=k, ddof=0) - compute the variance # np.std(a, axis=k, ddof=0) - compute the standard deviation
# np.all(a, axis=k) - return numpy.bool_ # np.any(a, axis=k) - return numpy.bool_ np.all([[True, False], [True, True]], axis=0) # array([ True, False]) np.any([[True, False], [False, False]], axis=1) # array([ True, False]) a = np.arange(-2, 3) # array([-2, -1, 0, 1, 2]) np.all(a > 0) # False np.any(a > 0) # True np.abs(a) # array([2, 1, 0, 1, 2])