-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
BUG: np.unique yields incorrect output for MaskedArray when axis is not None #23281
Comments
You should be using
Using any Python function from any library that expects numpy arrays but not masked arrays will react like that. gh-18675 is the issue discussing that, so I'll close this one. |
Thanks for taking a look at it. But it appears there is no axis option for np.ma.unique, which I need for performing unique along rows of a 2D array. Also I can't find the documentation for np.ma.unique. Should I open another issue about this? |
Ah good point, yes please! One seems to be a documentation issue, and the other a feature request that should not be too difficult to implement. |
Describe the issue:
np.unique seems to ignore MaskedArray mask when axis is not None, and returns a regular np.ndarray instead of a MaskedArray. In the code example below, the output is
but one should instead expect
Reproduce the code example:
Error message:
No response
Runtime information:
1.24.2
3.9.13 (main, Oct 13 2022, 16:12:19)
[Clang 12.0.0 ]
WARNING:
threadpoolctl
not found in system! Install it bypip install threadpoolctl
. Once installed, trynp.show_runtime
again for more detailed build information[{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP', 'ASIMDDP'],
'not_found': ['ASIMDFHM']}}]
None
Context for the issue:
I need to find unique rows in a 2D MaskedArray.
The text was updated successfully, but these errors were encountered: