New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
numpy.packbits doesn't accept a bool array #5377
Comments
This is a real problem, because packbits is the only workaround the fact that np.array of boolean use 8bit by boolean. This is a limit to how compact a memory structure can be. |
|
There is a question on SO about this issue http://stackoverflow.com/questions/34511362/packing-numpy-boolean-array-needs-tons-of-ram |
@LuisBL There is no need to cast the input array to the native px = np.packbits(x.view(np.uint8)) |
That feature was added in #5319, it does work in current master, so closing this. |
Example of problem
This results with an exception -- TypeError: Expected an input array of integer data type. This seems to go against the documentation of the function, which says it expects a 'binary-valued array'.
To make this work, you need to first convert the data type of the array to int, which seems redundant. eg.
A better use case of where I encountered the problem.
The text was updated successfully, but these errors were encountered: