[Numpy-discussion] Operations on a masked array of a scalar
Tue Jun 29 12:41:26 CDT 2010
I have a Python code working on MaskedArray which can produce arrays
of a number of different shapes and ranks. In an extreme case I get
"an array" constructed from a scalar:
Until the recent upgrade to Numpy 1.4.1 it has been possible to do
operations on such an object, like x+=2. or x==444. but now I have
the following problem:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
line 3567, in __eq__
check._mask = self._mask
AttributeError: 'numpy.bool_' object has no attribute '_mask'
The problem seems to be only with __eq__ and __ne__ operators, others
like __gt__ are ok:
masked_array(data = True,
mask = False,
fill_value = True)
For ndarray it works fine as well:
So did I find a bug or working with a "scalar array" is considered
dangerous and as such it should be avoided? In any case the behaviour
of Numpy 1.4.1 compared to 1.2.1 has changed in this aspect.
Many thanks for any comment.
More information about the NumPy-Discussion