summaryrefslogtreecommitdiff
path: root/numpy/lib/arraysetops.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-06-25 23:56:16 -0700
committerEric Wieser <wieser.eric@gmail.com>2018-06-29 02:14:48 -0700
commit917b0794e8e68a443f94299a80c51491cdc1c6cb (patch)
tree7ca1c9ad539db1efc350139f6fa375f6e3593f5d /numpy/lib/arraysetops.py
parent65f15a5e881817d8646571d36ab9a0bc39a6667e (diff)
downloadnumpy-917b0794e8e68a443f94299a80c51491cdc1c6cb.tar.gz
DOC: Clear up confusion between np.where(cond) and np.where(cond, x, y)
Eliminates all mentions of `np.where(cond)`, instead pointing the reader to np.nonzero. Also changes some example numbers to avoid collisions, making them easier to follow. Some minor doc improvements for np.ma.where too.
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],