numpy.ma.count(self, axis=None, keepdims=<no value>) = <numpy.ma.core._frommethod object>
Count the non-masked elements of the array along the given axis.
Parameters: |
|
---|---|
Returns: |
|
See also
count_masked
>>> import numpy.ma as ma >>> a = ma.arange(6).reshape((2, 3)) >>> a[1, :] = ma.masked >>> a masked_array( data=[[0, 1, 2], [--, --, --]], mask=[[False, False, False], [ True, True, True]], fill_value=999999) >>> a.count() 3
When the axis
keyword is specified an array of appropriate size is returned.
>>> a.count(axis=0) array([1, 1, 1]) >>> a.count(axis=1) array([3, 0])
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.ma.count.html