numpy.nancumprod()
is used when we want to calculate the cumulative product of array elements along a given axis, considering nonnumbers (NaN) as a whole. The total product does not change when NaNs are encountered and the leading NaNs are replaced by them. Units are returned for slices that are completely NaN or empty.
Syntax: numpy.nancumprod (arr, axis = None, dtype = None, out = None)
Parameters:
arr: [array_like] Array containing numbers whose sum is desired. If arr is not an array, a conversion is attempted.
axis: Axis along which the cumulative product is computed. The default is to compute the product of the flattened array.
dtype: Type of the returned array, as well as of the accumulator in which the elements are multiplied. If dtype is not specified, it defaults to the dtype of arr, unless arr has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used instead.
out: [ndarray, optional] A location into which the result is stored.
 & gt; If provided, it must have a shape that the inputs broadcast to.
 & gt; If not provided or None, a freshlyallocated array is returned.Return: A new array holding the result is returned unless out is specified, in which case it is returned.
Code # 1: Work

Output:
Input number: 10 cumulative product of input number: [10]
Code # 2:

Output:
Input array : [[2. 2. 2.] [2. 2. nan]] cumulative product of array elements: [2. 4. 8. 16. 32. 3 2.]
Code # 3:

Output:
Input array: [[2. 2. 2.] [2. 2. nan]] cumulative product of array elements taking axis 1: [[2. 4. 8.] [2. 4. 4.]]
Topics on Big Data are growing rapidly. From the first 3 V’s that originally characterized Big Data, the industry now has identified 42 V’s associated with Big Data. The list of how we characteriz...
10/07/2020
I remember one day, when I was about 15, my little cousin had come over. Being the good elder sister that I was, I spent time with her outside in the garden, while all the adults were inside having a ...
23/09/2020
Data and storage models are the basis for big data ecosystem stacks. While storage model captures the physical aspects and features for data storage, data model captures the logical representation and...
10/07/2020
Managing and analyzing data have always offered the greatest benefits and the greatest challenges for organizations of all sizes and across all industries. Businesses have long struggled with finding ...
10/07/2020