I tried to view a numpy int32 array as int8 type.
>>> a = np.array([1, 2, 3, 4], dtype='int32')
>>> a
array([1, 2, 3, 4], dtype=int32)
>>> a.view('int8')
array([1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0], dtype=int8)
I expect to convert 1 to [0, 0, 0, 1], but why it turns out to be [1, 0, 0, 0]? Is this related to how the number is stored in memory?
Thanks.