Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2335151

Browse files
authored
Merge pull request #14194 from eric-wieser/fix-14140
BUG: Remove the broken clip wrapper (Backport)
2 parents fb8c45c + 4e68aba commit 2335151

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

numpy/ma/core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5870,7 +5870,6 @@ def take(self, indices, axis=None, out=None, mode='raise'):
58705870
return out[()]
58715871

58725872
# Array methods
5873-
clip = _arraymethod('clip', onmask=False)
58745873
copy = _arraymethod('copy')
58755874
diagonal = _arraymethod('diagonal')
58765875
flatten = _arraymethod('flatten')

numpy/ma/tests/test_core.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,6 +3035,13 @@ def test_clip(self):
30353035
assert_equal(clipped._data, x.clip(2, 8))
30363036
assert_equal(clipped._data, mx._data.clip(2, 8))
30373037

3038+
def test_clip_out(self):
3039+
# gh-14140
3040+
a = np.arange(10)
3041+
m = np.ma.MaskedArray(a, mask=[0, 1] * 5)
3042+
m.clip(0, 5, out=m)
3043+
assert_equal(m.mask, [0, 1] * 5)
3044+
30383045
def test_compress(self):
30393046
# test compress
30403047
a = masked_array([1., 2., 3., 4., 5.], fill_value=9999)

0 commit comments

Comments
 (0)