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

Method __next__

numpy/ma/core.py:2669–2694  ·  view source on GitHub ↗

Return the next value, or raise StopIteration. Examples -------- >>> x = np.ma.array([3, 2], mask=[0, 1]) >>> fl = x.flat >>> next(fl) 3 >>> next(fl) masked >>> next(fl) Traceback (most recent call last):

(self)

Source from the content-addressed store, hash-verified

2667 self.maskiter[index] = getmaskarray(value)
2668
2669 def __next__(self):
2670 """
2671 Return the next value, or raise StopIteration.
2672
2673 Examples
2674 --------
2675 >>> x = np.ma.array([3, 2], mask=[0, 1])
2676 >>> fl = x.flat
2677 >>> next(fl)
2678 3
2679 >>> next(fl)
2680 masked
2681 >>> next(fl)
2682 Traceback (most recent call last):
2683 ...
2684 StopIteration
2685
2686 """
2687 d = next(self.dataiter)
2688 if self.maskiter is not None:
2689 m = next(self.maskiter)
2690 if isinstance(m, np.void):
2691 return mvoid(d, mask=m, hardmask=self.ma._hardmask)
2692 elif m: # Just a scalar, masked
2693 return masked
2694 return d
2695
2696
2697class MaskedArray(ndarray):

Callers 2

replFunction · 0.45
replace_parenthesisFunction · 0.45

Calls 2

mvoidClass · 0.85
nextFunction · 0.50

Tested by

no test coverage detected