Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine the endianness of a numpy array

I have a numpy.array and I want to find out what endianness is used in the underlying representation.

A byteorder property is documented here, but none of the given examples show it being used with an array.

like image 359
Brent Bradburn Avatar asked Dec 04 '15 21:12

Brent Bradburn


1 Answers

byteorder is a data type objects dtype attribute so you need to do this:

In [10]: import numpy as np

In [11]: arr = np.array([1,2,3])

In [12]: arr.dtype.byteorder
Out[12]: '='
like image 163
styvane Avatar answered Oct 15 '22 22:10

styvane