summaryrefslogtreecommitdiff
path: root/numpy/lib/index_tricks.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/index_tricks.py')
-rw-r--r--numpy/lib/index_tricks.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py
index f573cd4c6..afbcea056 100644
--- a/numpy/lib/index_tricks.py
+++ b/numpy/lib/index_tricks.py
@@ -41,6 +41,10 @@ def ix_(*args):
Parameters
----------
args : 1-D sequences
+ Each sequence should be of integer or boolean type.
+ Boolean sequences will be interpreted as boolean masks for the
+ corresponding dimension (equivalent to passing in
+ ``np.nonzero(boolean_sequence)``).
Returns
-------
@@ -58,7 +62,7 @@ def ix_(*args):
>>> a
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9]])
- >>> ixgrid = np.ix_([0,1], [2,4])
+ >>> ixgrid = np.ix_([0, 1], [2, 4])
>>> ixgrid
(array([[0],
[1]]), array([[2, 4]]))
@@ -68,6 +72,15 @@ def ix_(*args):
array([[2, 4],
[7, 9]])
+ >>> ixgrid = np.ix_([True, True], [2, 4])
+ >>> a[ixgrid]
+ array([[2, 4],
+ [7, 9]])
+ >>> ixgrid = np.ix_([True, True], [False, False, True, False, True])
+ >>> a[ixgrid]
+ array([[2, 4],
+ [7, 9]])
+
"""
out = []
nd = len(args)