-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Unable to test equality of structured dtypes with no fields #13438
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
Comments
Uggh, should structured data types with no fields even be allowed? In any case, the error is somewhat correct, at least not specific to masked arrays. While it does not happen for arrays, that is only because we replace the error with Frankly, I am not sure we should take action here. Out of curiosity do you actually have a use case for this dtype? |
Updated the top-post and title to reflect that masked arrays are irrelevant here. I'd argue this should just return |
@eric-wieser yes, sure (or an array of True). What I am not sure about is, what the point of a no field structured type is. On the other hand, I guess there is also no real reason against just allowing it. |
I honestly do not know, but currently you do and they crash, occasionally. This issue arose from astropy/astropy#8647 where I am trying to make I do not disagree with you that this is a rare situation but I think we should try to be consistent in how we handle edge cases. There are a couple of places in |
Yeah, I was a bit misguided, there is definitely no point in not allowing this (especially going backward!), so the void comparison code really should just be capable of handling this. |
This unfortunately is difficult to do correctly - not only does the shape of this array have to be correct, but it should probably inherit the right type through the array_ufunc mechanism. I think this issue might be unfixable until void comparison is done via a ufunc. |
Well, doing void comparison via a ufunc is very much doable though. And . while string ufuncs would be a bit annoying, a string comparison ufunc should be very much doable. Right now I would prefer not to put it on the agenda though probably. 1.17 is almost there, and I have some hope that we have some changes until 1.18... OTOH, the loops itself would still all work fine I suppose. |
Confirm that #14393 closed this:
|
Uh oh!
There was an error while loading. Please reload this page.
If a structure type has no fields, equality throws
Original report:
Test for equality of empty masked arrays raises an exception.
Reproducing code example:
Error message:
Numpy/Python version information:
1.16.3 3.6.1 (default, May 18 2017, 16:32:13)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]
The text was updated successfully, but these errors were encountered: