[Numpy-discussion] Convert array type

Charles R Harris charlesr.harris@gmail....
Mon Oct 8 14:52:46 CDT 2007


On 10/8/07, Adam Mercer <ramercer@gmail.com> wrote:
>
> On 08/10/2007, Ryan May <rmay@ou.edu> wrote:
>
> > Why not use numpy.fromstring?
>
> because that results in the array being filled with gibberish
>
> values = numpy.fromstring(wavearray, dtype=float, count=-1, sep='')
> print values


You need to use

values = numpy.fromstring(wavearray, dtype=float, count=-1, sep=' ')

Note that sep is a blank (whitespace). This will convert ascii strings.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20071008/8d40f21c/attachment.html 


More information about the Numpy-discussion mailing list