numpy.prod () returns the product of array elements along a given axis.
numpy.prod (a, axis = None, dtype = None, out = None, keepdims =) pre>
This is the input.
axis: none or int or a tuple of integers, it is optional
This is the axis or axes along which the product is produced. The default axis is None, it will calculate the product of all elements of the input array. If the axis is negative, it is counted from the last to the first axis.
If the axis is a tuple of integers, the product is performed along all axes specified in the tuple, not along one axis or all axes, as before.
dtype: dtype, optional
This is the type of the returned array as well as the accumulator that the elements are multiplied by. The d type for a is the default, unless a has an integer dtype with less precision than the platform`s default integer. In this case, if a is signed, then the platform integer is used, while if a is unsigned, then an unsigned integer of the same precision is used as the platform integer.
out: ndarray, optional
Alternative output array for placing the result. It should have the same shape as the expected result, but the type of the output values will be cast as needed.
keepdims: bool, optional
If this parameter is set to True, axes that are downsized remain in the result as dimensions with size one. With this option, the result will translate correctly with respect to the input array.
The product of an empty array will be neutral element 1:
Specifying the axis along which we multiply
Example 5 strong>
If type x is unsigned, the output type will be an unsigned integer platform