[Numpy-discussion] Convert array type
Ryan May
rmay at ou.edu
Mon Oct 8 13:43:00 EDT 2007
Gary Ruben wrote:
> Try using astype. This works:
>
> values = array(wavearray.split()).astype(float)
>
Why not use numpy.fromstring?
fromstring(string, dtype=float, count=-1, sep='')
Return a new 1d array initialized from the raw binary data in string.
If count is positive, the new array will have count elements,
otherwise its
size is determined by the size of string. If sep is not empty then the
string is interpreted in ASCII mode and converted to the desired
number type
using sep as the separator between elements (extra whitespace is
ignored).
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
More information about the NumPy-Discussion
mailing list