MCPcopy
hub / github.com/numpy/numpy / cumprod

Method cumprod

numpy/ma/core.py:5345–5374  ·  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

5343 product = prod
5344
5345 def cumprod(self, axis=None, dtype=None, out=None):
5346 """
5347 Return the cumulative product of the array elements over the given axis.
5348
5349 Masked values are set to 1 internally during the computation.
5350 However, their position is saved, and the result will be masked at
5351 the same locations.
5352
5353 Refer to `numpy.cumprod` for full documentation.
5354
5355 Notes
5356 -----
5357 The mask is lost if `out` is not a valid MaskedArray !
5358
5359 Arithmetic is modular when using integer types, and no error is
5360 raised on overflow.
5361
5362 See Also
5363 --------
5364 numpy.ndarray.cumprod : corresponding function for ndarrays
5365 numpy.cumprod : equivalent function
5366 """
5367 result = self.filled(1).cumprod(axis=axis, dtype=dtype, out=out)
5368 if out is not None:
5369 if isinstance(out, MaskedArray):
5370 out.__setmask__(self._mask)
5371 return out
5372 result = result.view(type(self))
5373 result.__setmask__(self._mask)
5374 return result
5375
5376 def mean(self, axis=None, dtype=None, out=None, keepdims=np._NoValue):
5377 """

Callers 8

test_attributesMethod · 0.80
nancumprodFunction · 0.80
fill_diagonalFunction · 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 4

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