NumPy ufuncLesson 38Free preview
ufunc Products
This lesson is part of NumPy · All levels
Summary
Np.prod calculates the multiplication of the entire array element, whereas np.cumprod produces a series of cumulative multiplication. Just like addition, axis parameters are available to calculate per row or per column. This multiplication is useful in calculating combined and factor probabilities.
Key points
- Returns the product of multiplying the entire element.
- It produces a series of moving multiples.
- Axis=0 counts multiplication per column, axis=1 per line.
- Be careful of empty arrays: the empty array is worth 1.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.