BUG: Fix numpy.isin for timedelta dtype#21860
Conversation
seberg
left a comment
There was a problem hiding this comment.
A few comments, I would lean towards using a .dtype.kind check, although that may require an update to not use in "ui?", but in ("u", "i", "?") for new dtypes soon...
|
One potential issue: However, this never ends up happening in practice, since |
|
Actually, it could happen, if ar1 is a bool and ar2 an integer array. ar2 could be over the range limit, and then ar1 will get converted to a |
|
Its fine, but it would be great if you could make sure we have tests "documenting" how these are expected to behave (parameterizing the methods again ideally). |
|
Sounds good. Just so I understand, is |
|
It does not matter right now. We just make the test pass with whatever behavior current (or previous) NumPy had. If you think it should maybe fail, add a comment to that effect. But the day where this fails is probably also the day where |
seberg
left a comment
There was a problem hiding this comment.
Thanks, going to apply those tweaks and merge in a bit. Especially thanks for adding those tests. More tests area always good, and now looking at it tests e.g. for datetime arrays with NaT might be nice (OTOH, those should be fine, since they use sorting/unique, which in turn should be fine!)
This is probably really mainly my personal opinion...
This PR fixes the issue discussed on #12065 and #21843 where
'timedelta64'was noted to be a subtype ofnumpy.integer. This in principle should detect any cases whereint(np.min(ar2))fails. This PR also adds unittests for these.@seberg @adeak could one of you have a look at this?
Thanks,
Miles