Hi,

I have used bitarray for that

  http://pypi.python.org/pypi/bitarray/

Here


http://code.google.com/p/pylibtiff/source/browse/#svn%2Ftrunk%2Flibtiff%2Fbitarray-0.3.5-numpy

you can find bitarray with numpy support.

HTH,
Pearu

On Mon, May 16, 2011 at 9:55 PM, Nikolas Tautenhahn <[email protected]> wrote:

> Hi,
>
> for some research, I need to convert lots of integers into their bit
> representation - but as a bit array, not a string like
> numpy.binary_repr() returns it.
>
> So instead of
> In [22]: numpy.binary_repr(23)
> Out[22]: '10111
>
>
> I'd need:
> numpy.binary_magic(23)
> Out: array([ True, False,  True,  True,  True], dtype=bool)
>
> is there any way to do this efficiently?
>
> best regards,
> Nik
> _______________________________________________
> NumPy-Discussion mailing list
> [email protected]
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to