Return array of indices to the minimum values along the given axis. Parameters ---------- axis : {None, integer} If None, the index is into the flattened array, otherwise along the specified axis fill_value : scalar or None, optional
(self, axis=None, fill_value=None, out=None, *,
keepdims=np._NoValue)
| 5589 | return filled.argsort(axis=axis, kind=kind, order=order) |
| 5590 | |
| 5591 | def argmin(self, axis=None, fill_value=None, out=None, *, |
| 5592 | keepdims=np._NoValue): |
| 5593 | """ |
| 5594 | Return array of indices to the minimum values along the given axis. |
| 5595 | |
| 5596 | Parameters |
| 5597 | ---------- |
| 5598 | axis : {None, integer} |
| 5599 | If None, the index is into the flattened array, otherwise along |
| 5600 | the specified axis |
| 5601 | fill_value : scalar or None, optional |
| 5602 | Value used to fill in the masked values. If None, the output of |
| 5603 | minimum_fill_value(self._data) is used instead. |
| 5604 | out : {None, array}, optional |
| 5605 | Array into which the result can be placed. Its type is preserved |
| 5606 | and it must be of the right shape to hold the output. |
| 5607 | |
| 5608 | Returns |
| 5609 | ------- |
| 5610 | ndarray or scalar |
| 5611 | If multi-dimension input, returns a new ndarray of indices to the |
| 5612 | minimum values along the given axis. Otherwise, returns a scalar |
| 5613 | of index to the minimum values along the given axis. |
| 5614 | |
| 5615 | Examples |
| 5616 | -------- |
| 5617 | >>> x = np.ma.array(np.arange(4), mask=[1,1,0,0]) |
| 5618 | >>> x.shape = (2,2) |
| 5619 | >>> x |
| 5620 | masked_array( |
| 5621 | data=[[--, --], |
| 5622 | [2, 3]], |
| 5623 | mask=[[ True, True], |
| 5624 | [False, False]], |
| 5625 | fill_value=999999) |
| 5626 | >>> x.argmin(axis=0, fill_value=-1) |
| 5627 | array([0, 0]) |
| 5628 | >>> x.argmin(axis=0, fill_value=9) |
| 5629 | array([1, 1]) |
| 5630 | |
| 5631 | """ |
| 5632 | if fill_value is None: |
| 5633 | fill_value = minimum_fill_value(self) |
| 5634 | d = self.filled(fill_value).view(ndarray) |
| 5635 | keepdims = False if keepdims is np._NoValue else bool(keepdims) |
| 5636 | return d.argmin(axis, out=out, keepdims=keepdims) |
| 5637 | |
| 5638 | def argmax(self, axis=None, fill_value=None, out=None, *, |
| 5639 | keepdims=np._NoValue): |