On Wed, Jul 27, 2011 at 2:49 AM, Mark Dickinson <[email protected]>wrote:

> In NumPy 1.6.0, I get the following behaviour:
>
>
> Python 2.7.2 |EPD 7.1-1 (32-bit)| (default, Jul  3 2011, 15:40:35)
> [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
> Type "packages", "demo" or "enthought" for more information.
> >>> import numpy
> >>> numpy.nanmin(numpy.ma.masked_array([1,2,3,4]))
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File
> "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/numpy/lib/function_base.py",
> line 1507, in nanmin
>    return np.fmin.reduce(a.flat)
> TypeError: cannot reduce on a scalar
> >>> numpy.__version__
> '1.6.0'
>
>
> In NumPy version 1.5.1:
>
> Python 2.7.2 |EPD 7.1-1 (32-bit)| (default, Jul  3 2011, 15:40:35)
> [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
> Type "packages", "demo" or "enthought" for more information.
> >>> import numpy
> >>> numpy.nanmin(numpy.ma.masked_array([1,2,3,4]))
> 1
> >>> numpy.__version__
> '1.5.1'
>
>
> Was this change intentional?
>
>
No, it comes from this

In [2]: a = numpy.ma.masked_array([1,2,3,4])

In [3]: array(a.flat)
Out[3]: array(<numpy.ma.core.MaskedIterator object at 0x1fd1f90>,
dtype='object')

i.e., the a.flat iterator is turned into an object array with one element.
I'm not sure what the correct fix for this would be. Please open a ticket.

Chuck
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to