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
On 08/10/2007, Ryan May [EMAIL PROTECTED] 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
gives:
[ 1.39804329e-076 1.30354290e-076 1.18295070e-076 ...,
Adam Mercer wrote:
On 08/10/2007, Ryan May [EMAIL PROTECTED] 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='')
Use sep=' '. As the docstring says, if sep is empty, then
On 10/8/07, Adam Mercer [EMAIL PROTECTED] wrote:
On 08/10/2007, Ryan May [EMAIL PROTECTED] 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
On 08/10/2007, Robert Kern [EMAIL PROTECTED] wrote:
Use sep=' '. As the docstring says, if sep is empty, then the string is
interpreted as binary data. If it is not empty, then the string is interpreted
as ASCII.
Thanks, got it the wrong way round. That works now.
Cheers
Adam
Hi
I am fairly new to using numpy and am running into a problem regarding
the type of an array. The array in question is created using the
following code:
values = array(wavearray.split())
where wavearray is a string containing a series of floats separated by
white space, it appears that the
Try using astype. This works:
values = array(wavearray.split()).astype(float)
Gary R.
Adam Mercer wrote:
values = array(wavearray.split())
where wavearray is a string containing a series of floats separated by
white space, it appears that the individual elements of the values
array are
On 07/10/2007, Gary Ruben [EMAIL PROTECTED] wrote:
Try using astype. This works:
values = array(wavearray.split()).astype(float)
Thanks Gary, that does the trick.
Cheers
Adam
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org