-
-
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 dtypeDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestEnhancement
Description
For an ordered index, there is a pandas.Index.asof() method that returns the most recent label to the label that's passed to it. However, in some cases it's useful to have a method that returns the nearest label to the label that is passed to it. For example:
>>> holidays = pandas.to_datetime(['2014-01-01','2014-01-20','2014-02-17'])
>>> print holidays.nearest('2014-01-15')
2014-01-20 00:00:00
Thoughts?
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 dtypeDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestEnhancement