-
Notifications
You must be signed in to change notification settings - Fork 20
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
DataArray.__eq__ with str dtype #4
Comments
This is what numpy does: In [38]: x = np.array([1,2]) In [39]: x == 1 Out[39]: array([ True, False], dtype=bool) In [40]: x = np.array(['a', 'b']) In [41]: x == 'a' Out[41]: array([ True, False], dtype=bool) In [42]: x == 1 Out[42]: False |
We may not be able to change the fact that the last case drops to a boolean False and doesn't return an array, but at least we should fix the second example so that we return a DatArray and not a plain array. |
Hrm, this seems like a potential headache. If you dig through the Numpy source, comparisons between character arrays follow a special code path that is different from the other comparison logic (see One potential fix would be to override |
Here is another quirk:
|
I'm not too crazy about the idea of overriding |
This looks good:
This doesn't (should return DataArrays):
The text was updated successfully, but these errors were encountered: