-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Multiple NaN from np.unique with masked arrays #19655
Labels
component: numpy.ma
masked arrays
Comments
import numpy as np
a3 = np.ma.masked_array([np.nan, np.nan, 2.0, np.nan, np.nan],
[True, False, False, True, False])
unique_a3 = np.unique(a3)
print('a3', a3)
# ... a3 [-- nan 2.0 -- nan]
print('unique_a3', np.unique(a3))
# ... unique_a3 [2.0 --]
# Fail, 0 NaNs.
assert np.count_nonzero(np.isnan(unique_a3)) == 1 |
Related to the post-merge discussion in #19301 |
Can I work on this issues? |
As of Numpy version 1.21.0, np.unique now returns single NaN:
|
Is the issue still open ? Can i work on this ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The new behavior of np.unique seems inconsistent with masked arrays.
Release notes for 1.2.1 https://numpy.org/devdocs/release/1.21.0-notes.html#np-unique-now-returns-single-nan
Reproducing code example:
NumPy/Python version information:
1.21.0 3.9.5 (default, May 11 2021, 08:20:37)
[GCC 10.3.0]
The text was updated successfully, but these errors were encountered: