Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert bytes to numpy array python

i = np.arange(2 * 2).reshape(2, 2)
# array([[0, 1],
#        [2, 3]])

k = i.tobytes()
# b'x00x00x00x00x01x00x00x00x02x00x00x00x03x00x00x00'

y = np.frombuffer(k, dtype=i.dtype)
# array([0, 1, 2, 3])
 
PREVIOUS NEXT
Tagged: #convert #bytes #numpy #array #python
ADD COMMENT
Topic
Name
6+1 =