Search
 
SCRIPT & CODE EXAMPLE
 

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])
Comment

PREVIOUS NEXT
Code Example
Python :: mode code python 
Python :: django not saving images forms 
Python :: python cube root 
Python :: pandas open text file 
Python :: how to calculate mean in python 
Python :: check if coroutine python 
Python :: random with probability python 
Python :: pil image shape 
Python :: remove all of same value python list 
Python :: how to move a column to last in pandas 
Python :: how to find largest number in array in python 
Python :: os file exists 
Python :: os.getlogin() python 
Python :: from sklearn.metrics import classification_report 
Python :: python global site packages 
Python :: python delete the last line of console 
Python :: change each line color as a rainbow python 
Python :: python get current user windows 
Python :: pyqt tex 
Python :: read text from a pdffile python 
Python :: run python script from c# 
Python :: django password change view 
Python :: python know the number of a loop 
Python :: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable. 
Python :: pandas select data conditional 
Python :: from PyQt5 import Qsci 
Python :: how to multiply two tuples in python 
Python :: find null value for a particular column in dataframe 
Python :: python udp receive 
Python :: store all files name in a folder python 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =