summaryrefslogtreecommitdiff
path: root/numpy/core/multiarray.py
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2019-02-13 18:14:05 +0200
committermattip <matti.picus@gmail.com>2019-05-11 09:44:05 -0700
commitc2de04da9b0feb2853b9814c7953aa51a29a058e (patch)
tree6cf444560593dd835df2e037ccc915a464531036 /numpy/core/multiarray.py
parent634d66d5c5461c6c1480e97c1d3fbc4c4ea96a00 (diff)
downloadnumpy-c2de04da9b0feb2853b9814c7953aa51a29a058e.tar.gz
ENH: add 'order' keyword to packbits, unpackbits
Diffstat (limited to 'numpy/core/multiarray.py')
-rw-r--r--numpy/core/multiarray.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/numpy/core/multiarray.py b/numpy/core/multiarray.py
index a839ae402..8ea71cde4 100644
--- a/numpy/core/multiarray.py
+++ b/numpy/core/multiarray.py
@@ -8,6 +8,7 @@ by importing from the extension module.
import functools
import warnings
+import sys
from . import overrides
from . import _multiarray_umath
@@ -1113,7 +1114,7 @@ def putmask(a, mask, values):
@array_function_from_c_func_and_dispatcher(_multiarray_umath.packbits)
-def packbits(a, axis=None):
+def packbits(a, axis=None, order='big'):
"""
packbits(a, axis=None)
@@ -1129,6 +1130,11 @@ def packbits(a, axis=None):
axis : int, optional
The dimension over which bit-packing is done.
``None`` implies packing the flattened array.
+ order : 'big' or 'little', only the first letter is checked
+ The order of the returned bits. The default is the common standard
+ where 3 => [0, 0, 0, 0, 0, 1, 1]
+
+ .. versionadded:: 1.17.0
Returns
-------
@@ -1164,7 +1170,7 @@ def packbits(a, axis=None):
@array_function_from_c_func_and_dispatcher(_multiarray_umath.unpackbits)
-def unpackbits(a, axis=None, count=None):
+def unpackbits(a, axis=None, count=None, order='big'):
"""
unpackbits(a, axis=None, count=None)
@@ -1194,6 +1200,12 @@ def unpackbits(a, axis=None, count=None):
.. versionadded:: 1.17.0
+ order : 'big' or 'little', only the first letter is checked
+ The order of the returned bits. The default is the common standard
+ where 3 => [0, 0, 0, 0, 0, 1, 1]
+
+ .. versionadded:: 1.17.0
+
Returns
-------
unpacked : ndarray, uint8 type