Closed
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?