numpy.ndarray.newbyteorder — NumPy v1.24 Manual (original) (raw)

method

ndarray.newbyteorder(new_order='S', /)#

Return the array with the same data viewed with a different byte order.

Equivalent to:

arr.view(arr.dtype.newbytorder(new_order))

Changes are also made in all fields and sub-arrays of the array data type.

Parameters:

new_orderstring, optional

Byte order to force; a value from the byte order specifications below. new_order codes can be any of:

The default value (‘S’) results in swapping the current byte order.

Returns:

new_arrarray

New array object with the dtype reflecting given change to the byte order.