bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / ma / extras / notmasked_contiguous
function
numpy.ma.extras:notmasked_contiguous
source: build-install/usr/lib/python3.14/site-packages/numpy/ma/extras.py :2032
Signature
def notmasked_contiguous ( a , axis = None ) Summary
Find contiguous unmasked data in a masked array along the given axis.
Parameters
a: array_likeThe input array.
axis: int, optionalAxis along which to perform the operation. If None (default), applies to a flattened version of the array, and this is the same as flatnotmasked_contiguous.
Returns
endpoints: listA list of slices (start and end indexes) of unmasked indexes in the array.
If the input is 2d and axis is specified, the result is a list of lists.
Notes
Only accepts 2-D arrays at most.
Examples
import numpy as np a = np.arange(12).reshape((3, 4)) mask = np.zeros_like(a) mask[1:, :-1] = 1; mask[0, 1] = 1; mask[-1, 0] = 0 ma = np.ma.array(a, mask=mask) ma✓
np.array(ma[~ma.mask])
✗np.ma.notmasked_contiguous(ma)
✓np.ma.notmasked_contiguous(ma, axis=0)
✓np.ma.notmasked_contiguous(ma, axis=1)
✓See also
Aliases
-
numpy.ma.notmasked_contiguous