def _count(a, axis=None):
 if hasattr(a, 'count'):
  num = a.count(axis=axis)
  if (isinstance(num, np.ndarray) and (num.ndim == 0)):
   num = int(num)
 elif (axis is None):
  num = a.size
 else:
  num = a.shape[axis]
 return num

def _count ( a , axis = None ) : if hasattr ( a , 'count' ) : num = a . count ( axis = axis ) if ( isinstance ( num , np . ndarray ) and ( num . ndim == 0 ) ) : num = int ( num ) elif ( axis is None ) : num = a . size else : num = a . shape [ axis ] return num
count the number of non-masked elements of an array .