numpy.ma.MaskedArray.count() function - Python Last Updated : 05 May, 2020 Comments Improve Suggest changes Like Article Like Report 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 None, performs the count over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis. keepdims : [bool, optional] If this is set to True, the axis which is reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array. Return : [ndarray or scalar] An array with the same shape as the input array, with the specified axis removed. If the array is a 0-d array, or if axis is None, a scalar is returned. Code #1 : Python3 # Python program explaining # numpy.ma.MaskedArray.count() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = ma.arange(6).reshape((2, 3)) arr[1, :] = ma.masked gfg = arr.count(axis = 0) print (gfg) Output : [1 1 1] Code #2 : Python3 # Python program explaining # numpy.ma.MaskedArray.count() function # importing numpy as geek # and numpy.ma module as ma import numpy as geek import numpy.ma as ma arr = ma.arange(6).reshape((2, 3)) arr[1, :] = ma.masked gfg = arr.count() print (gfg) Output : 3 Comment More infoAdvertise with us Next Article numpy.ma.MaskedArray.count() 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.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 Numpy MaskedArray.cumsum() function | Python numpy.MaskedArray.cumsum() Return the cumulative sum of the masked array elements over the given axis.Masked values are set to 0 internally during the computation. However, their position is saved, and the result will be masked at the same locations. Syntax : numpy.ma.cumsum(axis=None, dtype=None, o 3 min read Numpy MaskedArray.anom() 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.argsort() 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 Numpy MaskedArray.cumprod() function | Python numpy.MaskedArray.cumprod() Return the cumulative product of the masked array elements over the given axis.Masked values are set to 1 internally during the computation. However, their position is saved, and the result will be masked at the same locations. Syntax : numpy.ma.cumprod(axis=None, dtype=N 3 min read Numpy MaskedArray.masked_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 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.ma.clump_masked() function | Python numpy.ma.clump_masked() function returns a list of slices corresponding to the masked clumps of a 1-D array. Syntax : numpy.ma.clump_masked(arr) Parameters : arr : [ndarray] A one-dimensional masked array. Return : [list of slice] The list of slices, one for each continuous region of masked elements 1 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.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 Like