【发布时间】:2016-11-14 13:06:14
【问题描述】:
dtype='f'、dtype='f4'、dtype='>f4'、dtype'<f4' 有什么区别?
docs on types 中没有解释语法(除了 'f' 是 'float32' 的简写);它在records的页面中被广泛使用,但>/<的含义在那里也没有解释。
经过一些实验,我发现
In [13]: a = np.array([1.0], dtype='f')
In [15]: print(a.dtype)
float32
和
In [16]: a = np.array([1.0], dtype='<f4')
In [17]: print(a.dtype)
float32
但是
In [18]: a = np.array([1.0], dtype='>f4')
In [19]: print(a.dtype)
>f4
这让我相信这些是不等价的,这可能是我在使用外部库时遇到的问题的解释。
【问题讨论】: