diff options
Diffstat (limited to 'numpy/ma')
-rw-r--r-- | numpy/ma/core.py | 22 | ||||
-rw-r--r-- | numpy/ma/tests/test_core.py | 7 |
2 files changed, 9 insertions, 20 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index f221b319a..95b799f6d 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -77,7 +77,7 @@ __all__ = [ 'maximum_fill_value', 'mean', 'min', 'minimum', 'minimum_fill_value', 'mod', 'multiply', 'mvoid', 'ndim', 'negative', 'nomask', 'nonzero', 'not_equal', 'ones', 'outer', 'outerproduct', 'power', 'prod', - 'product', 'ptp', 'put', 'putmask', 'rank', 'ravel', 'remainder', + 'product', 'ptp', 'put', 'putmask', 'ravel', 'remainder', 'repeat', 'reshape', 'resize', 'right_shift', 'round', 'round_', 'set_fill_value', 'shape', 'sin', 'sinh', 'size', 'soften_mask', 'sometrue', 'sort', 'sqrt', 'squeeze', 'std', 'subtract', 'sum', @@ -4455,7 +4455,7 @@ class MaskedArray(ndarray): if m is nomask: # compare to _count_reduce_items in _methods.py - if self.shape is (): + if self.shape == (): if axis not in (None, 0): raise np.AxisError(axis=axis, ndim=self.ndim) return 1 @@ -5887,7 +5887,6 @@ class MaskedArray(ndarray): return out[()] # Array methods - clip = _arraymethod('clip', onmask=False) copy = _arraymethod('copy') diagonal = _arraymethod('diagonal') flatten = _arraymethod('flatten') @@ -7099,23 +7098,6 @@ def resize(x, new_shape): return result -def rank(obj): - """ - maskedarray version of the numpy function. - - .. note:: - Deprecated since 1.10.0 - - """ - # 2015-04-12, 1.10.0 - warnings.warn( - "`rank` is deprecated; use the `ndim` function instead. ", - np.VisibleDeprecationWarning, stacklevel=2) - return np.ndim(getdata(obj)) - -rank.__doc__ = np.rank.__doc__ - - def ndim(obj): """ maskedarray version of the numpy function. diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index 9fe550ef8..b72ce56aa 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -3035,6 +3035,13 @@ class TestMaskedArrayMethods(object): assert_equal(clipped._data, x.clip(2, 8)) assert_equal(clipped._data, mx._data.clip(2, 8)) + def test_clip_out(self): + # gh-14140 + a = np.arange(10) + m = np.ma.MaskedArray(a, mask=[0, 1] * 5) + m.clip(0, 5, out=m) + assert_equal(m.mask, [0, 1] * 5) + def test_compress(self): # test compress a = masked_array([1., 2., 3., 4., 5.], fill_value=9999) |