MCPcopy Create free account
hub / github.com/numpy/numpy / cumprod

Method cumprod

numpy/ma/core.py:5275–5304  ·  view source on GitHub ↗

Return the cumulative product of the array elements over the given axis. Masked values are set to 1 internally during the computation. However, their position is saved, and the result will be masked at the same locations. Refer to `numpy.cumprod` for full d

(self, axis=None, dtype=None, out=None)

Source from the content-addressed store, hash-verified

5273 product = prod
5274
5275 def cumprod(self, axis=None, dtype=None, out=None):
5276 """
5277 Return the cumulative product of the array elements over the given axis.
5278
5279 Masked values are set to 1 internally during the computation.
5280 However, their position is saved, and the result will be masked at
5281 the same locations.
5282
5283 Refer to `numpy.cumprod` for full documentation.
5284
5285 Notes
5286 -----
5287 The mask is lost if `out` is not a valid MaskedArray !
5288
5289 Arithmetic is modular when using integer types, and no error is
5290 raised on overflow.
5291
5292 See Also
5293 --------
5294 numpy.ndarray.cumprod : corresponding function for ndarrays
5295 numpy.cumprod : equivalent function
5296 """
5297 result = self.filled(1).cumprod(axis=axis, dtype=dtype, out=out)
5298 if out is not None:
5299 if isinstance(out, MaskedArray):
5300 out.__setmask__(self._mask)
5301 return out
5302 result = result.view(type(self))
5303 result.__setmask__(self._mask)
5304 return result
5305
5306 def mean(self, axis=None, dtype=None, out=None, keepdims=np._NoValue):
5307 """

Callers 9

test_attributesMethod · 0.80
fill_diagonalFunction · 0.80
nancumprodFunction · 0.80
test_basicMethod · 0.80
test_result_valuesMethod · 0.80
ndarray_misc.pyFile · 0.80
fromnumeric.pyFile · 0.80
test_cumprodMethod · 0.80
test_cumsumprodMethod · 0.80

Calls 3

filledMethod · 0.95
__setmask__Method · 0.80
viewMethod · 0.45

Tested by 5

test_attributesMethod · 0.64
test_basicMethod · 0.64
test_result_valuesMethod · 0.64
test_cumprodMethod · 0.64
test_cumsumprodMethod · 0.64