-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Inconsistent behavior of partial string indexing vs straight indexing for timeseries data #9732
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
So the typical way to thing about how slices are interpreted is [49], where slices are partial string indexing, see here. This basically expands a partial date to be inclusive of times for that date, e.g. '2011-01-02' is implicity '2011-01-02 11:59:59.999999999' However for straight indexing, these values are simply converted as is, e.g. '2011-01-02' -> '2011-01-02 00:00:00.000000000'. I think these should be consistent, so we'll call this a bug. Though this may be a bit tricky to fix, see
|
I'm actually a little surprised this works -- you can't compare either Timestamp or np.datetime64 arrays to strings. But, I agree with @jreback that this is a nice feature and it would be good to fix it. |
Seems like there hasn't been much interest in this feature over the years so closing |
I recently ran into an issue where pandas is not handling the "<=" logical operator when comparing dates in an interesting way.
Anything after 2011-01-02 00:00:00 is not included in the less than or equal to 2011-01-02. One would expect that less than or equal to mean that entire day. Is this by design, or is this a bug?
The text was updated successfully, but these errors were encountered: