numpy.ma.notmasked_contiguous function | Python
numpy.ma.notmasked_contiguous() function find contiguous unmasked data in a masked array along the given axis.
Syntax : numpy.ma.notmasked_contiguous(arr, axis = None)
arr : [array_like] The input array.
axis : [int, optional] Axis along which to perform the operation. Default is None.
Return : [list] A 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.
Code #1 :
[slice(0, 1, None), slice(2, 4, None), slice(7, 9, None), slice(11, 12, None)]
Code #2 :
[[slice(0, 1, None), slice(2, 4, None)], [slice(3, 4, None)], [slice(0, 1, None), slice(3, 4, None)]]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course