diff options
author | Patrick Peglar <patrick.peglar@metoffice.gov.uk> | 2014-08-31 14:01:12 +0100 |
---|---|---|
committer | Patrick Peglar <patrick.peglar@metoffice.gov.uk> | 2014-08-31 14:01:12 +0100 |
commit | 37ff2cd602df98ef72b3a33816ff2832a3163c6b (patch) | |
tree | c3367bbd694e06eb9ecb72d871172c9223825653 /numpy/lib/arraysetops.py | |
parent | 9c50f988ac27dd1758dbc46455573aaa77638c68 (diff) | |
download | numpy-37ff2cd602df98ef72b3a33816ff2832a3163c6b.tar.gz |
DOC: warn about using a set with 'in1d'.
Diffstat (limited to 'numpy/lib/arraysetops.py')
-rw-r--r-- | numpy/lib/arraysetops.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py index 5ace7146a..bc80d0ecd 100644 --- a/numpy/lib/arraysetops.py +++ b/numpy/lib/arraysetops.py @@ -333,6 +333,10 @@ def in1d(ar1, ar2, assume_unique=False, invert=False): `in1d` can be considered as an element-wise function version of the python keyword `in`, for 1-D sequences. ``in1d(a, b)`` is roughly equivalent to ``np.array([item in b for item in a])``. + However, this idea fails if `ar2` is a set, or similar (non-sequence) + container: As ``ar2`` is converted to an array, in those cases + ``asarray(ar2)`` is an object array rather than the expected array of + contained values. .. versionadded:: 1.4.0 |