[Numpy-discussion] How do I change endianess?

Robert Kern robert.kern@gmail....
Mon Feb 25 12:51:31 CST 2008


On Mon, Feb 25, 2008 at 12:44 PM,  <debl2@verizon.net> wrote:
> I would like to change the Endianess of a large of data written on PC so I can process it on a Solaris box.  I see that the dtype.str attribute is read-only.

Read it in with the appropriately-endian dtype in the first place.


import numpy
dt = numpy.dtype(numpy.int32).newbyteorder('<')

-- 
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