Guided Notes
Ufuncs & Broadcasting
Universal functions, arithmetic, rounding and logs, creating your own ufuncs, and broadcasting rules.
Universal functions (ufuncs)
Slide 1 / 5A ufunc is a NumPy function that works element by element on whole arrays β np.add, np.sqrt, np.exp, np.log, np.round, and many more.
np.add(x, y) is exactly what x + y does behind the scenes. Every arithmetic operator on arrays calls a ufunc.
Ufuncs are implemented in C, support broadcasting, and take extra options such as where= (apply only where a condition is true) and out= (write into an existing array).
