Re: [Numpy-discussion] Converting char array to float

2007-11-28 Thread Travis E. Oliphant
Sameer DCosta wrote: > I'm trying to convert a character array to a floating point array. I'm > using one of the recent svn builds. It is surprising that astype does > not do the job. However if I first convert the char array to an array > and then use astype everything works fine. Is this a bug? >

Re: [Numpy-discussion] Converting char array to float

2007-11-28 Thread Pierre GM
On Wednesday 28 November 2007 13:39:45 Matthieu Brucher wrote: > a does not seem to be an array, so it is not surprising that you need to > convert it to an array first. Well, a *IS* a regular chararray, and therefore a subclass of ndarray (try isinstance). The problem isn't here, it's that the s

Re: [Numpy-discussion] Converting char array to float

2007-11-28 Thread Pierre GM
Sameer, I can't tell whether it's a bug or a feature, but I can give you some explanation: when you call .astype on your chararray, you call the __array_finalize__ of the chararray, which requires the dtype to be string like. Obviously, that won't work in your case. Transforming the chararray t

Re: [Numpy-discussion] Converting char array to float

2007-11-28 Thread Matthieu Brucher
a does not seem to be an array, so it is not surprising that you need to convert it to an array first. Matthieu 2007/11/28, Sameer DCosta <[EMAIL PROTECTED]>: > > I'm trying to convert a character array to a floating point array. I'm > using one of the recent svn builds. It is surprising that ast

[Numpy-discussion] Converting char array to float

2007-11-28 Thread Sameer DCosta
I'm trying to convert a character array to a floating point array. I'm using one of the recent svn builds. It is surprising that astype does not do the job. However if I first convert the char array to an array and then use astype everything works fine. Is this a bug? import numpy as N print N.__v