diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-02-23 14:58:08 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-03-07 17:33:22 +0000 |
commit | 8e83849f4412cd00501251c58902fba4f9e4b60a (patch) | |
tree | c597a0d10e11f02c7d099078c4bb79638664fb03 /numpy/ma | |
parent | 11c5a9f3fed6ccd2a8f77b22cc1abb405b9d24ab (diff) | |
download | numpy-8e83849f4412cd00501251c58902fba4f9e4b60a.tar.gz |
MAINT: Reduce indentation, and remove erroneous return value
Diffstat (limited to 'numpy/ma')
-rw-r--r-- | numpy/ma/core.py | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 219bea2f6..52e558fc1 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -5444,35 +5444,36 @@ class MaskedArray(ndarray): """ if self._mask is nomask: ndarray.sort(self, axis=axis, kind=kind, order=order) - else: - if self is masked: - return self - if fill_value is None: - if endwith: - # nan > inf - if np.issubdtype(self.dtype, np.floating): - filler = np.nan - else: - filler = minimum_fill_value(self) + return + + if self is masked: + return + + if fill_value is None: + if endwith: + # nan > inf + if np.issubdtype(self.dtype, np.floating): + filler = np.nan else: - filler = maximum_fill_value(self) + filler = minimum_fill_value(self) else: - filler = fill_value + filler = maximum_fill_value(self) + else: + filler = fill_value - sidx = self.filled(filler).argsort(axis=axis, kind=kind, - order=order) - # save meshgrid memory for 1d arrays - if self.ndim == 1: - idx = sidx - else: - idx = np.meshgrid(*[np.arange(x) for x in self.shape], sparse=True, - indexing='ij') - idx[axis] = sidx - tmp_mask = self._mask[idx].flat - tmp_data = self._data[idx].flat - self._data.flat = tmp_data - self._mask.flat = tmp_mask - return + sidx = self.filled(filler).argsort(axis=axis, kind=kind, + order=order) + # save meshgrid memory for 1d arrays + if self.ndim == 1: + idx = sidx + else: + idx = np.meshgrid(*[np.arange(x) for x in self.shape], sparse=True, + indexing='ij') + idx[axis] = sidx + tmp_mask = self._mask[idx].flat + tmp_data = self._data[idx].flat + self._data.flat = tmp_data + self._mask.flat = tmp_mask def min(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue): """ |