[Numpy-discussion] How do I change endianess?

Robert Kern robert.kern at gmail.com
Mon Feb 25 13:51:31 EST 2008


On Mon, Feb 25, 2008 at 12:44 PM,  <debl2 at 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