[Numpy-discussion] bug in vectorize? (was: Re: Casting a float array into a string array)

Anne Archibald peridot.faceted@gmail....
Fri Oct 5 16:39:28 CDT 2007

On 05/10/2007, Christopher Barker <Chris.Barker@noaa.gov> wrote:

> I don't know how to generalize this to n-d though -- maybe numpy.vectorize?

Oops! Looks like there's a big somewhere:

In [1]: from numpy import *

In [2]: vectorize(lambda x: "%5.3g" % x)(ones((2,2,2)))
array([[[' ', '\xc1'],
        [' ', '\xc1']],

       [[' ', '\xc1'],
        [' ', '\xc1']]],

In [3]: vectorize?
Segmentation fault (core dumped)

In particular, vectorize creates a string array (rather than an object
array), and some unsafe operation is done on that array.


More information about the Numpy-discussion mailing list