numpy.ma.notmasked_edges() function | Python
numpy.ma.notmasked_edges() function find the indices of the first and last unmasked values along an axis.
Return None, if all values are masked. Otherwise, return a list of two tuples, corresponding to the indices of the first and last unmasked values respectively.
Syntax : numpy.ma.notmasked_edges(arr, axis = None)
arr : [array_like] The input array.
axis : [int, optional] Axis along which to perform the operation. Default is None.
Return : [ ndarray or list] An array of start and end indexes if there are any masked data in the array. If there are no masked data in the array, edges is a list of the first and last index.
Code #1 :
[ 0, 11]
Code #2 :
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