The first element of your join_binary_split_array is an empty string:
print(repr(binary_split_array[0])) ''
The first item on your list:
'\x00\x00\x00\x00\x00\x00\x00\x00'
The empty string has a length of 0:
print([len("".join(a)) for a in binary_split_array]) print([len("".join(a)) for a in binary_list]) [0, 8, 8, 8, 8, 8, 8, 8, 8, 8] [8, 8, 8, 8, 8, 8, 8, 8, 8, 8]
Byte String Length 8:
print(len('\x00\x00\x00\x00\x00\x00\x00\x00')) 8
A tobytes call will give the same output length as the list:
print(len(binary_split_array.tobytes())) 80 table_fromstring = np.fromstring(binary_split_array.tobytes(), dtype='float64') print table_fromstring [ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9.]
The numpy array handles empty bytes differently for python, null bytes are truncated.
Padraic cunningham
source share