[Numpy-discussion] Best dtype for Boolean values

John Jack itsmilesdavis@gmail....
Mon Apr 12 10:59:46 CDT 2010

Hello all.

I am (relatively) new to python, and 100% new to numpy.

I need a way to store arrays of booleans and compare the arrays for

I assume I want arrays of dtype Boolean, and I should compare the arrays
with array_equal

>>> tmp.all_states
array([False,  True, False], dtype=bool)
>>> tmp1.all_states
array([False, False, False], dtype=bool)
>>> tmp1.all_states[1]=True
>>> tmp1.all_states
array([False,  True, False], dtype=bool)
>>> array_equal(tmp.all_states,tmp1.all_states)
>>> any(tmp.all_states)

Would this be (a) the cheapest way (w.r.t. memory) to store Booleans and (b)
the most efficient way to compare two lists of Booleans?

Thanks for your advice.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100412/a97162d1/attachment.html 

More information about the NumPy-Discussion mailing list