Closed
Description
When using numpy.r_
to, for example, append a value to an array, the operation fails with a ValueError
if the element to be appended is masked. The behavior should be to add another masked value to the end of the array. See below where the exact same use of r_
fails when using a masked element.
Python 3.6.0 (default, Dec 24 2016, 08:02:28)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.14.0.dev0+18f69fd'
>>> x = np.ma.arange(3)
>>> np.r_[x, x[-1]]
masked_array(data = [0 1 2 2],
mask = False,
fill_value = 999999)
>>> x[-1] = np.ma.masked
>>> np.r_[x, x[-1]]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jniehus/Documents/dev/numpy_test_env/lib/python3.6/site-packages/numpy-1.14.0.dev0+18f69fd-py3.6-macosx-10.10-x86_64.egg/numpy/lib/index_tricks.py", line 340, in __getitem__
res = self.concatenate(tuple(objs), axis=axis)
ValueError: all the input arrays must have same number of dimensions