[Numpy-discussion] byte swap in place
robert.kern at gmail.com
Tue Jun 6 16:33:38 CDT 2006
Christopher Hanley wrote:
> Is there a way to byte swap a ndarray in place? The "byteswap" method I
> have found on an ndarray object currently returns a new array.
Depends. Do you want the actual bytes to swap, or are you content with getting a
view that pretends the bytes are swapped? If the latter:
>>> a = arange(5)
>>> a.dtype = dtype('<i4')
array([ 0, 16777216, 33554432, 50331648, 67108864])
"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