[Numpy-discussion] Convert array type

Robert Kern robert.kern at gmail.com
Mon Oct 8 15:51:48 EDT 2007


Adam Mercer wrote:
> On 08/10/2007, Ryan May <rmay at 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='')

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.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list