summaryrefslogtreecommitdiff
path: root/numpy/lib/arraysetops.py
diff options
context:
space:
mode:
authorMarten van Kerkwijk <mhvk@astro.utoronto.ca>2018-06-29 10:20:42 -0400
committerGitHub <noreply@github.com>2018-06-29 10:20:42 -0400
commit166b39fd8ed6ad07e129682c3d42ba55da706d58 (patch)
tree891f253f62d49280a0d076574e199c863001c8a7 /numpy/lib/arraysetops.py
parenta6383b4d0a5ef51178755b2e1f418265b2304f75 (diff)
parent917b0794e8e68a443f94299a80c51491cdc1c6cb (diff)
downloadnumpy-166b39fd8ed6ad07e129682c3d42ba55da706d58.tar.gz
Merge pull request #11425 from eric-wieser/where-nonzero-docs
DOC: Clear up confusion between np.where(cond) and np.where(cond, x, y)
Diffstat (limited to 'numpy/lib/arraysetops.py')
-rw-r--r--numpy/lib/arraysetops.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py
index 4d3f35183..5880ea154 100644
--- a/numpy/lib/arraysetops.py
+++ b/numpy/lib/arraysetops.py
@@ -607,6 +607,14 @@ def isin(element, test_elements, assume_unique=False, invert=False):
[ True, False]])
>>> element[mask]
array([2, 4])
+
+ The indices of the matched values can be obtained with `nonzero`:
+
+ >>> np.nonzero(mask)
+ (array([0, 1]), array([1, 0]))
+
+ The test can also be inverted:
+
>>> mask = np.isin(element, test_elements, invert=True)
>>> mask
array([[ True, False],