{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/10411","labels_url":"https://api.github.com/repos/pydata/pandas/issues/10411/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/10411/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/10411/events","html_url":"https://github.com/pydata/pandas/pull/10411","id":90322246,"number":10411,"title":"ENH: max_distance for limiting nearest neighbor reindexing","user":{"login":"shoyer","id":1217238,"avatar_url":"https://avatars.githubusercontent.com/u/1217238?v=3","gravatar_id":"","url":"https://api.github.com/users/shoyer","html_url":"https://github.com/shoyer","followers_url":"https://api.github.com/users/shoyer/followers","following_url":"https://api.github.com/users/shoyer/following{/other_user}","gists_url":"https://api.github.com/users/shoyer/gists{/gist_id}","starred_url":"https://api.github.com/users/shoyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoyer/subscriptions","organizations_url":"https://api.github.com/users/shoyer/orgs","repos_url":"https://api.github.com/users/shoyer/repos","events_url":"https://api.github.com/users/shoyer/events{/privacy}","received_events_url":"https://api.github.com/users/shoyer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/API%20Design","name":"API Design","color":"AD7FA8"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Indexing","name":"Indexing","color":"0b02e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-06-23T08:21:54Z","updated_at":"2015-07-20T04:12:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pydata/pandas/pulls/10411","html_url":"https://github.com/pydata/pandas/pull/10411","diff_url":"https://github.com/pydata/pandas/pull/10411.diff","patch_url":"https://github.com/pydata/pandas/pull/10411.patch"},"body":"xref #9817\r\n\r\nThis does not entirely solve the floating point precision issues, but gets us part of the way there -- we can explicitly lookup data with a fixed tolerance for nearest neighbor matches.\r\n\r\nIt is also is useful in its own right, mostly as a simple sanity check to verify that labels are not entirely misaligned.\r\n\r\nExample usage:\r\n```\r\nIn [2]: df = pd.DataFrame({'x': range(5)})\r\n\r\nIn [3]: df.reindex([0.1, 1.9, 3.5], method='nearest', max_distance=0.2)\r\nOut[3]:\r\n      x\r\n0.1   0\r\n1.9   2\r\n3.5 NaN\r\n```"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/122755442","html_url":"https://github.com/pydata/pandas/pull/10411#issuecomment-122755442","issue_url":"https://api.github.com/repos/pydata/pandas/issues/10411","id":122755442,"user":{"login":"shoyer","id":1217238,"avatar_url":"https://avatars.githubusercontent.com/u/1217238?v=3","gravatar_id":"","url":"https://api.github.com/users/shoyer","html_url":"https://github.com/shoyer","followers_url":"https://api.github.com/users/shoyer/followers","following_url":"https://api.github.com/users/shoyer/following{/other_user}","gists_url":"https://api.github.com/users/shoyer/gists{/gist_id}","starred_url":"https://api.github.com/users/shoyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoyer/subscriptions","organizations_url":"https://api.github.com/users/shoyer/orgs","repos_url":"https://api.github.com/users/shoyer/repos","events_url":"https://api.github.com/users/shoyer/events{/privacy}","received_events_url":"https://api.github.com/users/shoyer/received_events","type":"User","site_admin":false},"created_at":"2015-07-20T04:12:26Z","updated_at":"2015-07-20T04:12:26Z","body":"You now get errors if you try to use `limit` or `tolerance` with the default reindexing method.\r\n\r\nWith the current approach, you get a `ValueError` when you try to use `get_indexer` with an invalid tolerance, but `KeyError` on `DatetimeIndex.get_loc`. The later is because `get_loc` currently uses a rats nest of exception handling to allow for various types of indexers. Adding the proper error for an invalid tolerance there is probably a good idea but I'm not sure it's worth the trouble...."}}