This question might be pretty simple to answer, but I had problems finding obvious answer in the numpy documentation.
What is the dtype to select when initializing a binary numpy array as follows:
array = np.zeros(8, dtype=np.int)
You can use np.bool:
array = np.zeros(8, dtype=np.bool)
output:
array([False, False, False, False, False, False, False, False])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.