Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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)
.packbits
You can use np.bool:
array = np.zeros(8, dtype=np.bool)
output:
array([False, False, False, False, False, False, False, False])
Add a comment
np.bool
array = np.zeros(8, dtype=bool)
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
.packbits? docs.scipy.org/doc/numpy-1.15.0/reference/generated/…