ufuncs are special NumPy functions designed to work with arrays; in particular, they support vectorization. A vectorized function is applied component-wise to the elements of an array. These are often highly optimized functions, running under the hood on a faster language, such as C.
In the following, we see some common ufuncs, many of which are mathematical:
Let's explore some applications of ufuncs. The first thing we're going to do is find the sign of every element in arr1, that is, whether it is positive, negative, or zero:
Then with this sign, I multiply this array with arr1. The result is as if we took the ...