ENH: tolerance now takes list-like argument for reindex and get_indexer.
State: closed

Enable use of list-like values for tolerance argument in DataFrame.reindex(), Series.reindex(), Index.get_indexer().

- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Labels:
name: Enhancement
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves

Comments:
Hello @buntwo! Thanks for updating the PR.

































Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on October 14, 2017 at 19:10 Hours UTC
does this have an associated issue?

can u show an example use case
Use case: suppose you have a timeseries of values for a stock, with some days with missing data in between, and you want to select some date range that includes the missing data. You want to have some fill backward (forward, nearest) N-many-days logic when doing so, but you want N to depend on some other property of the stock that varies as time. Currently pandas only supports N constant. This features enables this use case, by allowing the user to construct a list-like object of the same size that contains the tolerance per point and pass that in.
@buntwo : It seems like you want the tolerance time-varying.  I *suppose* that could be useful, but I haven't seen a use-case like this really.

I would suggest you open an issue for this and point your PR to it so we can discuss.

In the future, for enhancements like this, it would be preferable to open an issue first so that we can discuss rather than in the PR.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@36dadd7`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `95.91%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17367/graphs/tree.svg?width=650&src=pr&token=eZ4WkYLtcO&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##             master   #17367   +/-   ##
=========================================
  Coverage          ?   91.02%           
=========================================
  Files             ?      162           
  Lines             ?    49603           
  Branches          ?        0           
=========================================
  Hits              ?    45150           
  Misses            ?     4453           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.8% <95.91%> (?)` | |
| #single | `40.22% <10.2%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `91.99% <ø> (ø)` | |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `96.75% <100%> (ø)` | |
| [pandas/core/indexes/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9udW1lcmljLnB5) | `97.24% <100%> (ø)` | |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.35% <100%> (ø)` | |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `95.89% <100%> (ø)` | |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `92.5% <77.77%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=footer). Last update [36dadd7...d6ec1d6](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=h1) Report
> Merging [#17367](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/e001500cb934ffdbc2baa082a1f17be4d7aa953f?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `92.68%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17367/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17367      +/-   ##
==========================================
- Coverage   91.24%   91.21%   -0.03%     
==========================================
  Files         163      163              
  Lines       50080    50099      +19     
==========================================
+ Hits        45693    45700       +7     
- Misses       4387     4399      +12
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.02% <92.68%> (-0.01%)` | :arrow_down: |
| #single | `40.31% <21.95%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.2% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `91.19% <100%> (ø)` | :arrow_up: |
| [pandas/core/tools/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvdGltZWRlbHRhcy5weQ==) | `98.38% <100%> (+0.05%)` | :arrow_up: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `97.1% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9udW1lcmljLnB5) | `97.23% <100%> (+0.05%)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.42% <80%> (-0.06%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.5% <83.33%> (-0.08%)` | :arrow_down: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `92.68% <91.66%> (-0.11%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.75% <0%> (-0.1%)` | :arrow_down: |
| ... and [1 more](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=footer). Last update [e001500...7e7051a](https://codecov.io/gh/pandas-dev/pandas/pull/17367?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

The failed test in appveyor I think has nothing to do with my change, didn't fail on the last commit.
@buntwo ok parametrized the tests, ping on green.
going to fail from some flake errors

``git diff master -u "*.py" | flake8 --diff``
will show you them
also rebase on master (you don't need to squash, though its easier to do so)
your rebasing is removing things. just leave it and restore code (in a new commit) that was removed. making sure all tests pass.
Apologies for the mistake in rebasing. I used git diff to cherry pick the unintended changes and git apply -R to revert.
Ping
thanks @buntwo 
thank you @jreback !