numpy.ma.masked_array.mini

method

masked_array.mini(axis=None)[源代码]

Return the array minimum along the specified axis.

1.13.0 版后已移除: This function is identical to both:

  • self.min(keepdims=True, axis=axis).squeeze(axis=axis)
  • np.ma.minimum.reduce(self, axis=axis)

Typically though, self.min(axis=axis) is sufficient.

Parameters:
axis : int, optional

The axis along which to find the minima. Default is None, in which case the minimum value in the whole array is returned.

Returns:
min : scalar or MaskedArray

If axis is None, the result is a scalar. Otherwise, if axis is given and the array is at least 2-D, the result is a masked array with dimension one smaller than the array on which mini is called.

Examples

>>> x = np.ma.array(np.arange(6), mask=[0 ,1, 0, 0, 0 ,1]).reshape(3, 2)
>>> print(x)
[[0 --]
 [2 3]
 [4 --]]
>>> x.mini()
0
>>> x.mini(axis=0)
masked_array(data = [0 3],
             mask = [False False],
       fill_value = 999999)
>>> print(x.mini(axis=1))
[0 2 4]

There is a small difference between mini and min:

>>> x[:,1].mini(axis=0)
masked_array(data = --,
             mask = True,
       fill_value = 999999)
>>> x[:,1].min(axis=0)
masked