8000 BUG: assert_equal fails on object arrays of nan · Issue #9023 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: assert_equal fails on object arrays of nan #9023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eric-wieser opened this issue Apr 29, 2017 · 1 comment
Open

BUG: assert_equal fails on object arrays of nan #9023

eric-wieser opened this issue Apr 29, 2017 · 1 comment

Comments

@eric-wieser
Copy link
Member

The following fails:

import numpy as np
from numpy.testing import assert_equal 
a = np.array([1, 2, np.nan], object)
assert_equal(a, a)
AssertionError:
Arrays are not equal

(mismatch 33.33333333333333%)
 x: array([1, 2, nan], dtype=object)
 y: array([1, 2, nan], dtype=object)
@h-vetinari
Copy link
Contributor
h-vetinari commented Apr 12, 2023

Also affects other assert functions like assert_array_equal, assert_allclose

Additionally, assert_allclose fails on empty object arrays:

>>> np.__version__
'1.24.2'
>>> x = np.array([], dtype=object)
>>> np.testing.assert_allclose(x, x)
Traceback (most recent call last):
[...]
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0