-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffDatetimeDatetime data dtypeDatetime data dtypeIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves
Milestone
Description
DatetimeIndex._maybe_cast_slice_bound
can return the wrong value when you have an index that is monotonically decreasing, but not strictly monotonically decreasing.
In [1]: import pandas as pd
In [2]: pd.DatetimeIndex(['2017', '2017'])
Out[2]: DatetimeIndex(['2017-01-01', '2017-01-01'], dtype='datetime64[ns]', freq=None)
In [3]: pd.DatetimeIndex(['2017', '2017'])._maybe_cast_slice_bound('2017-01-01', 'left', 'loc')
Out[3]: Timestamp('2017-01-01 23:59:59.999999999')
The issue is here That check really needs to check for strict monotonic decreasing, not just monotonic decreasing.
Have we hit any other needs for strict monotonic algos? This is such an extreme edge case, not sure it's worthwhile on its own.
Came up in dask/dask#2389
Metadata
Metadata
Assignees
Labels
AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffDatetimeDatetime data dtypeDatetime data dtypeIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves