I have started learning NumPy recently. My question is why floating numbers start from 'f2'
, but integer numbers can start from 'i1'
?
Code example:
>>> import numpy as np
>>> arr = np.array([x for x in range(10)], dtype='i1')
>>> arr
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=int8)
>>> new_arr = arr.astype('f1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: data type 'f1' not understood
>>> new_arr = arr.astype('f2')
>>> new_arr
array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.], dtype=float16)
>>>
I also know a little bit about showing integer number in binary format.