[Numpy-discussion] Problems casting object arrays to string type on Ubuntu
dyamins at gmail.com
Sat Nov 21 15:27:33 EST 2009
I'm having some issues casting object arrays to string type, especially on
my Ubuntu installation. (Ubuntu Jaunty, 9.04, with Numpy v. 1.3.)
With small arrays, the conversion is just wrong. With large arrays, there
seems to be some memory corruption. Conversion to int or float (when
appropriate) seems to work.
For instance, here are some examples of errors with small arrays:
>>> X = numpy.array([13,14],'object')
>>> X.astype('int') #conversion to int or float seems to work fine
array([ 13., 14.])
>>> X = numpy.array(['cat','bat'],'object')
In : X = numpy.array(['cat','bat']*300000,'object')
In : Y = X.astype('|S3')
*** glibc detected *** /usr/bin/python: munmap_chunk(): invalid pointer:
I do NOT have this problem with Numpy 1.4.0.dev7746, installed on my OSX
10.5.8 machine. There, everything seems to work fine.
What's going on? I feel like I've seem some traffic about related issues on
the list before, but I couldn't quite tell from reading the threads what the
"final upshot" of the discussion was ... Is this something that was fixed
in recent NumPy 1.4 releases, or is something about my Ubuntu vs. OSX
installations? Generally speaking can I / should I be relying on casting
from object arrays to do the "right" (or "intuitive") thing?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion