diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2019-11-04 17:32:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-04 17:32:10 -0700 |
commit | 4393e0c0cb1772d0f9691117d238d000b209decd (patch) | |
tree | 5dda9c9a885af59ecdcd4c3c947e69bd6bab48bf /doc/release | |
parent | 7b8513fff4c3673d8a967a1d72a73feab2072e8f (diff) | |
parent | 9aa8c4756d7282dd49a7093ce7a6725258106b9a (diff) | |
download | numpy-4393e0c0cb1772d0f9691117d238d000b209decd.tar.gz |
Merge pull request #14800 from mattip/reorder-obj-comparison-loop
ENH: change object-array comparisons to prefer OO->O unfuncs
Diffstat (limited to 'doc/release')
-rw-r--r-- | doc/release/upcoming_changes/14800.improvement.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/release/upcoming_changes/14800.improvement.rst b/doc/release/upcoming_changes/14800.improvement.rst new file mode 100644 index 000000000..158c31536 --- /dev/null +++ b/doc/release/upcoming_changes/14800.improvement.rst @@ -0,0 +1,14 @@ +Comparison on ``object`` dtypes will prefer ``object`` output +------------------------------------------------------------- +Comparison ufuncs (``np.equal`` and friends) would return boolean arrays when +the input array dtype was ``object``. This led to inconsistent behaviour for +ragged arrays ``a = np.array([1, np.array([1, 2, 3])], dtype=object)``. This +will now return an object array:: + + >>> a = np.array([1, np.array([1, 2, 3])], dtype=object) + >>> np.equal(a, a) + array([True, array([ True, True, True])], dtype=object) + +The old behaviour, which will raise a ``ValueError`` in this case, is still +available by specifying a dtype as ``np.equal(a, a, dtype=bool)``. + |