Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation.
Parameters : | axis : {None, int}, optional
dtype : {None, dtype}, optional
out : {None, array}, optional
|
---|---|
Returns : | product_along_axis : {array, scalar}, see dtype parameter above.
|
See also
Notes
Arithmetic is modular when using integer types, and no error is raised on overflow.
Examples
>>> np.prod([1.,2.])
2.0
>>> np.prod([1.,2.], dtype=np.int32)
2
>>> np.prod([[1.,2.],[3.,4.]])
24.0
>>> np.prod([[1.,2.],[3.,4.]], axis=1)
array([ 2., 12.])