Universal function methods
How can functions have methods? As we said earlier, universal functions are not functions but objects representing functions. Universal functions have four methods. They only make sense for functions such as add
. That is, they have two input parameters and return one output parameter. If the signature of an ufunc does not match this condition, this will result in a ValueError
, so call this method only for binary universal functions. The four methods are listed as follows:
reduce
accumulate
reduceat
outer