diff options
author | slepton <slepton@posteo.de> | 2021-07-07 21:25:53 +0200 |
---|---|---|
committer | slepton <slepton@posteo.de> | 2021-07-07 21:25:53 +0200 |
commit | d19584547a7934bfce9dee445e65a2c1994cecdc (patch) | |
tree | 2013779442bff7d9f47464fd3a1b6ba755b0070d /numpy/ma/core.py | |
parent | 5ac75798362cea6ecbd602a46b80c297b0f6712a (diff) | |
parent | de245cd133699f8c23f97ec07ec29703e37a5923 (diff) | |
download | numpy-d19584547a7934bfce9dee445e65a2c1994cecdc.tar.gz |
Merge remote-tracking branch 'origin/main' into main
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r-- | numpy/ma/core.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index e3c6bc611..152d17965 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -5488,7 +5488,8 @@ class MaskedArray(ndarray): filled = self.filled(fill_value) return filled.argsort(axis=axis, kind=kind, order=order) - def argmin(self, axis=None, fill_value=None, out=None): + def argmin(self, axis=None, fill_value=None, out=None, *, + keepdims=np._NoValue): """ Return array of indices to the minimum values along the given axis. @@ -5531,9 +5532,11 @@ class MaskedArray(ndarray): if fill_value is None: fill_value = minimum_fill_value(self) d = self.filled(fill_value).view(ndarray) - return d.argmin(axis, out=out) + keepdims = False if keepdims is np._NoValue else bool(keepdims) + return d.argmin(axis, out=out, keepdims=keepdims) - def argmax(self, axis=None, fill_value=None, out=None): + def argmax(self, axis=None, fill_value=None, out=None, *, + keepdims=np._NoValue): """ Returns array of indices of the maximum values along the given axis. Masked values are treated as if they had the value fill_value. @@ -5568,7 +5571,8 @@ class MaskedArray(ndarray): if fill_value is None: fill_value = maximum_fill_value(self._data) d = self.filled(fill_value).view(ndarray) - return d.argmax(axis, out=out) + keepdims = False if keepdims is np._NoValue else bool(keepdims) + return d.argmax(axis, out=out, keepdims=keepdims) def sort(self, axis=-1, kind=None, order=None, endwith=True, fill_value=None): |