-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
isin doesn't work for Timestamps #5021
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
This just came up again: http://stackoverflow.com/questions/19551336/using-isin-with Options: (1) Raise. Irritating but no one will get the wrong answer. (2) Detect common cases like timestamps which don't place nicely with hashes and do list membership testing instead of set membership testing. Slow for big collections but it'll give the right answer, and probably work well enough in the typical case of a small group. (2b) Instead of list membership testing, sort and then bisect if the to-be-tested collection is big enough. (3) Make sure that standard time objects have compatible hashes. |
@dsm054 thanks for the ping on this.....pretty easy to fix actually....just need to convert to i8 for date/time like inputs and it works with the existing methods |
Does that preserve precision? When I ran the idea of coercing to a common type past @cpcloud, he seemed sceptical. |
yep....this is what we do with date/time-likes....the in64's are in nanoseconds |
it doesn't use the |
@dsm054 do you have any more tests that you think I ought to include? |
Do python datetimes hash to their integer value? The ts class does use the object hash if there are no nanoseconds which I would assume constitutes the majority of use cases. |
it doesn't matter in this case, as everything hashes as the value which is the num of nanoseconds in epoch space |
Ah ok nice |
right I saw ur pr. Just convert to int b4 hand |
Maybe test that an ndarray and series as an arg to isin return the same result |
Ndarray with datetime64 style that is |
Dtype I meant |
ok...sure |
works just fine (because
|
SO question: http://stackoverflow.com/q/19070194/564538
The text was updated successfully, but these errors were encountered: