NumPy ufuncLesson 32Free preview
ufunc Intro
This lesson is part of NumPy · All levels
Summary
Universal function (ufunc) is a function that works on all elements of an array element-wise at high speed because it is implemented in C. For example, np.add, np.subtract, np.multiply, np.sqrt, and np.mod. NumPy also provides checker ufuncs such as np.isnan and np.isinf for data cleaning needs.
Key points
- Ufunc processes elements one by one without an explicit Python loop.
- Examples of ufunc arithmetic: add, subtract, multiply, divide, power, mod.
- The built-in ufunc includes square roots, logic, and abstraction.
- Np.isnan and np.isinf are useful for checking invalid values such as NaN or inf.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.