[Numpy-discussion] Loading bit strings

Zachary Pincus zachary.pincus@yale....
Fri Mar 5 12:07:03 CST 2010


> Is there a good way in NumPy to convert from a bit string to a boolean
> array?
>
> For example, if I have a 2-byte string s='\xfd\x32', I want to get a
> 16-length boolean array out of it.

numpy.unpackbits(numpy.fromstring('\xfd\x32', dtype=numpy.uint8))


More information about the NumPy-Discussion mailing list