summaryrefslogtreecommitdiff
path: root/numpy/lib/arraysetops.py
diff options
context:
space:
mode:
authorJamie <dodgerbarker@gmail.com>2021-02-10 18:12:08 +0000
committerJamie <dodgerbarker@gmail.com>2021-02-10 18:12:08 +0000
commit7828422c59947132e173cc0802059a8fe0858201 (patch)
treeb7c59706d2a6118d28ce7f4ff2b2c549b01d5c26 /numpy/lib/arraysetops.py
parent922f6d12a20347d46c6d21a210ccb026565761b8 (diff)
parent00f6ddb9881a9587c915b3db00fa6e99bd025bf3 (diff)
downloadnumpy-7828422c59947132e173cc0802059a8fe0858201.tar.gz
Merge remote-tracking branch 'upstream/master' into histogram-binwidth-doc
Diffstat (limited to 'numpy/lib/arraysetops.py')
-rw-r--r--numpy/lib/arraysetops.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py
index 6c6c1ff80..eb5c488e4 100644
--- a/numpy/lib/arraysetops.py
+++ b/numpy/lib/arraysetops.py
@@ -565,6 +565,10 @@ def in1d(ar1, ar2, assume_unique=False, invert=False):
ar1 = np.asarray(ar1).ravel()
ar2 = np.asarray(ar2).ravel()
+ # Ensure that iteration through object arrays yields size-1 arrays
+ if ar2.dtype == object:
+ ar2 = ar2.reshape(-1, 1)
+
# Check if one of the arrays may contain arbitrary objects
contains_object = ar1.dtype.hasobject or ar2.dtype.hasobject