Return the minimum along a given axis. Parameters ---------- axis : None or int or tuple of ints, optional Axis along which to operate. By default, ``axis`` is None and the flattened input is used. .. versionadded:: 1.7.0
(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue)
| 5758 | self[...] = np.take_along_axis(self, sidx, axis=axis) |
| 5759 | |
| 5760 | def min(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue): |
| 5761 | """ |
| 5762 | Return the minimum along a given axis. |
| 5763 | |
| 5764 | Parameters |
| 5765 | ---------- |
| 5766 | axis : None or int or tuple of ints, optional |
| 5767 | Axis along which to operate. By default, ``axis`` is None and the |
| 5768 | flattened input is used. |
| 5769 | .. versionadded:: 1.7.0 |
| 5770 | If this is a tuple of ints, the minimum is selected over multiple |
| 5771 | axes, instead of a single axis or all the axes as before. |
| 5772 | out : array_like, optional |
| 5773 | Alternative output array in which to place the result. Must be of |
| 5774 | the same shape and buffer length as the expected output. |
| 5775 | fill_value : scalar or None, optional |
| 5776 | Value used to fill in the masked values. |
| 5777 | If None, use the output of `minimum_fill_value`. |
| 5778 | keepdims : bool, optional |
| 5779 | If this is set to True, the axes which are reduced are left |
| 5780 | in the result as dimensions with size one. With this option, |
| 5781 | the result will broadcast correctly against the array. |
| 5782 | |
| 5783 | Returns |
| 5784 | ------- |
| 5785 | amin : array_like |
| 5786 | New array holding the result. |
| 5787 | If ``out`` was specified, ``out`` is returned. |
| 5788 | |
| 5789 | See Also |
| 5790 | -------- |
| 5791 | ma.minimum_fill_value |
| 5792 | Returns the minimum filling value for a given datatype. |
| 5793 | |
| 5794 | Examples |
| 5795 | -------- |
| 5796 | >>> import numpy.ma as ma |
| 5797 | >>> x = [[1., -2., 3.], [0.2, -0.7, 0.1]] |
| 5798 | >>> mask = [[1, 1, 0], [0, 0, 1]] |
| 5799 | >>> masked_x = ma.masked_array(x, mask) |
| 5800 | >>> masked_x |
| 5801 | masked_array( |
| 5802 | data=[[--, --, 3.0], |
| 5803 | [0.2, -0.7, --]], |
| 5804 | mask=[[ True, True, False], |
| 5805 | [False, False, True]], |
| 5806 | fill_value=1e+20) |
| 5807 | >>> ma.min(masked_x) |
| 5808 | -0.7 |
| 5809 | >>> ma.min(masked_x, axis=-1) |
| 5810 | masked_array(data=[3.0, -0.7], |
| 5811 | mask=[False, False], |
| 5812 | fill_value=1e+20) |
| 5813 | >>> ma.min(masked_x, axis=0, keepdims=True) |
| 5814 | masked_array(data=[[0.2, -0.7, 3.0]], |
| 5815 | mask=[[False, False, False]], |
| 5816 | fill_value=1e+20) |
| 5817 | >>> mask = [[1, 1, 1,], [1, 1, 1]] |