diff options
author | Michael Seifert <michaelseifert04@yahoo.de> | 2017-02-18 02:19:57 +0100 |
---|---|---|
committer | Michael Seifert <michaelseifert04@yahoo.de> | 2017-02-18 21:42:46 +0100 |
commit | 8d31fcb09b1a704bfa2b692bc322847cfae52132 (patch) | |
tree | 020b0c8037fd55f9ea71278ae89f63a131793096 /numpy/lib/index_tricks.py | |
parent | d55f40b1e48d5a5fbed80e00a140c9db6e19732f (diff) | |
download | numpy-8d31fcb09b1a704bfa2b692bc322847cfae52132.tar.gz |
DOC: Mention boolean arrays in the ix_ documentation.
Diffstat (limited to 'numpy/lib/index_tricks.py')
-rw-r--r-- | numpy/lib/index_tricks.py | 15 |
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) |