numpy.ma.MaskedArray.nonzero() function - Python Last Updated : 05 May, 2020 Comments Improve Suggest changes Like Article Like Report numpy.ma.MaskedArray.nonzero() function return the indices of unmasked elements that are not zero. This function returns a tuple of arrays, one for each dimension, containing the indices of the non-zero elements in that dimension. Syntax : numpy.ma.MaskedArray.nonzero(self) Return : [tuple] Indices of elements that are non-zero. Code #1 : Python3 # Python program explaining # numpy.ma.MaskedArray.nonzero() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = ma.array(geek.eye(5)) gfg = arr.nonzero() print (gfg) Output : (array([0, 1, 2, 3, 4]), array([0, 1, 2, 3, 4])) Code #2 : Python3 # Python program explaining # numpy.ma.MaskedArray.nonzero() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = ma.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) gfg = ma.nonzero(arr > 3) print (gfg) Output : (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) Comment More infoAdvertise with us Next Article numpy.ma.MaskedArray.nonzero() function - Python sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy python Python Numpy-Masked Array Practice Tags : Machine Learningpython Similar Reads Numpy MaskedArray.mean() function | Python numpy.MaskedArray.mean() function is used to return the average of the masked array elements along given axis.Here masked entries are ignored, and result elements which are not finite will be masked. Syntax : numpy.ma.mean(axis=None, dtype=None, out=None) Parameters: axis :[ int, optional] Axis alon 3 min read numpy.ma.make_mask_none() function | Python numpy.ma.make_mask_none() function return a boolean mask of the given shape, filled with False. This function returns a boolean ndarray with all entries False, that can be used in common mask manipulations. If a complex dtype is specified, the type of each field is converted to a boolean type. Synta 1 min read numpy.ma.MaskedArray.count() function - Python numpy.ma.MaskedArray.count() function count the non-masked elements of the array along the given axis. Syntax : numpy.ma.MaskedArray.count(self, axis=None, keepdims = no value) Parameters : axis : [None or int or tuple of ints, optional] Axis along which the count is performed. The default axis is N 2 min read numpy.ma.MaskedArray.tolist() function - Python numpy.ma.MaskedArray.tolist() function return the data portion of the masked array as a hierarchical Python list. Syntax : numpy.ma.MaskedArray.tolist(fill_value = None) Parameters : axis : [scalar, optional] The value to use for invalid entries. Default is None. Return : [list] The Python list repr 1 min read Numpy MaskedArray.masked_not_equal() function | Python In many circumstances, datasets can be incomplete or tainted by the presence of invalid data. For example, a sensor may have failed to record a data, or recorded an invalid value. The numpy.ma module provides a convenient way to address this issue, by introducing masked arrays.Masked arrays are arra 2 min read numpy.ma.MaskedArray.toflex() function - Python numpy.ma.MaskedArray.toflex() function transforms a masked array into a flexible-type array. The flexible type array that is returned will have two fields: the _data field and the _mask field. The _data field stores the _data part of the array and the _mask field stores the _mask part of the array. 2 min read Numpy MaskedArray.median() function | Python numpy.MaskedArray.median() function is used to compute the median along the specified axis of a masked array.It returns the median of the array elements. Syntax : numpy.ma.median(arr, axis=None, out=None, overwrite_input=False, keepdims=False) Parameters: arr : [ ndarray ] Input masked array. axis : 3 min read Numpy MaskedArray.masked_less() function | Python In many circumstances, datasets can be incomplete or tainted by the presence of invalid data. For example, a sensor may have failed to record a data, or recorded an invalid value. The numpy.ma module provides a convenient way to address this issue, by introducing masked arrays.Masked arrays are arra 2 min read Numpy MaskedArray.all() function | Python In many circumstances, datasets can be incomplete or tainted by the presence of invalid data. For example, a sensor may have failed to record a data, or recorded an invalid value. The numpy.ma module provides a convenient way to address this issue, by introducing masked arrays. Masked arrays are arr 3 min read Numpy MaskedArray.any() function | Python In many circumstances, datasets can be incomplete or tainted by the presence of invalid data. For example, a sensor may have failed to record a data, or recorded an invalid value. The numpy.ma module provides a convenient way to address this issue, by introducing masked arrays.Masked arrays are arra 3 min read Like