Return the minimum along a given axis. Parameters ---------- axis : {None, int}, optional Axis along which to operate. By default, ``axis`` is None and the flattened input is used. out : array_like, optional Alternative o
(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue)
| 5563 | self[...] = np.take_along_axis(self, sidx, axis=axis) |
| 5564 | |
| 5565 | def min(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue): |
| 5566 | """ |
| 5567 | Return the minimum along a given axis. |
| 5568 | |
| 5569 | Parameters |
| 5570 | ---------- |
| 5571 | axis : {None, int}, optional |
| 5572 | Axis along which to operate. By default, ``axis`` is None and the |
| 5573 | flattened input is used. |
| 5574 | out : array_like, optional |
| 5575 | Alternative output array in which to place the result. Must be of |
| 5576 | the same shape and buffer length as the expected output. |
| 5577 | fill_value : {var}, optional |
| 5578 | Value used to fill in the masked values. |
| 5579 | If None, use the output of `minimum_fill_value`. |
| 5580 | |
| 5581 | Returns |
| 5582 | ------- |
| 5583 | amin : array_like |
| 5584 | New array holding the result. |
| 5585 | If ``out`` was specified, ``out`` is returned. |
| 5586 | |
| 5587 | See Also |
| 5588 | -------- |
| 5589 | minimum_fill_value |
| 5590 | Returns the minimum filling value for a given datatype. |
| 5591 | |
| 5592 | """ |
| 5593 | kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims} |
| 5594 | |
| 5595 | _mask = self._mask |
| 5596 | newmask = _check_mask_axis(_mask, axis, **kwargs) |
| 5597 | if fill_value is None: |
| 5598 | fill_value = minimum_fill_value(self) |
| 5599 | # No explicit output |
| 5600 | if out is None: |
| 5601 | result = self.filled(fill_value).min( |
| 5602 | axis=axis, out=out, **kwargs).view(type(self)) |
| 5603 | if result.ndim: |
| 5604 | # Set the mask |
| 5605 | result.__setmask__(newmask) |
| 5606 | # Get rid of Infs |
| 5607 | if newmask.ndim: |
| 5608 | np.copyto(result, result.fill_value, where=newmask) |
| 5609 | elif newmask: |
| 5610 | result = masked |
| 5611 | return result |
| 5612 | # Explicit output |
| 5613 | result = self.filled(fill_value).min(axis=axis, out=out, **kwargs) |
| 5614 | if isinstance(out, MaskedArray): |
| 5615 | outmask = getmask(out) |
| 5616 | if (outmask is nomask): |
| 5617 | outmask = out._mask = make_mask_none(out.shape) |
| 5618 | outmask.flat = newmask |
| 5619 | else: |
| 5620 | if out.dtype.kind in 'biu': |
| 5621 | errmsg = "Masked data information would be lost in one or more"\ |
| 5622 | " location." |
no test coverage detected