issue #27642 - timedelta merge asof with tolerance
State: closed

- [X] closes #27642 
- [x] tests 2 / 1 [added / passed] 
- [X] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry
- [ ] \(Optional) allow users to pass datetime.timedelta objects for tolerance

Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Timedelta
description: Timedelta data type

Comments:
Hello @ianzur! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:





There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-08-22 11:36:23 UTC
My first PR, please be gentle.
Does anyone understand why my test fails in python3.5?
On phone so haven’t checked logs but if 3.5 only most likely the construction of data frames from Dict don’t have a defined order. 

Probably easiest to construct from lists

Sent from my iPhone

> On Aug 8, 2019, at 8:27 AM, ianzur <notifications@github.com> wrote:
> 
> Does anyone understand why my test fails in python3.5?
> 
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub, or mute the thread.

@ianzur you may want to set up a 3.5 env locally for testing that. `conda env create -n pandas-azure-35-compat -f ci/deps/azure-35-compat.yaml`
Could you open one with an example of the failure right now?

On Thu, Aug 22, 2019 at 8:27 AM ianzur <notifications@github.com> wrote:

> *@ianzur* commented on this pull request.
> ------------------------------
>
> In pandas/tests/reshape/merge/test_merge_asof.py
> <https://github.com/pandas-dev/pandas/pull/27650#discussion_r316676824>:
>
> > @@ -588,14 +590,23 @@ def test_non_sorted(self):
>          # ok, though has dupes
>          merge_asof(trades, self.quotes, on="time", by="ticker")
>
> -    def test_tolerance(self):
> +    @pytest.mark.parametrize(
> +        "tolerance",
> +        [
> +            Timedelta("1day"),
> +            pytest.param(
> +                datetime.timedelta(days=1),
> +                marks=pytest.mark.xfail(reason="not implemented", strict=True),
>
> No, not that I know of.
>
> —
> You are receiving this because you modified the open/close state.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/27650?email_source=notifications&email_token=AAKAOIU5BQ66CXKQS367NEDQF2H55A5CNFSM4IHWN4YKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCCME7GY#discussion_r316676824>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOIR2IAWBEU2N2CDI5TTQF2H55ANCNFSM4IHWN4YA>
> .
>

I can later today, I'll @you.

On Thu, Aug 22, 2019 at 9:03 AM Tom Augspurger <notifications@github.com>
wrote:

> Could you open one with an example of the failure right now?
>
> On Thu, Aug 22, 2019 at 8:27 AM ianzur <notifications@github.com> wrote:
>
> > *@ianzur* commented on this pull request.
> > ------------------------------
> >
> > In pandas/tests/reshape/merge/test_merge_asof.py
> > <https://github.com/pandas-dev/pandas/pull/27650#discussion_r316676824>:
> >
> > > @@ -588,14 +590,23 @@ def test_non_sorted(self):
> > # ok, though has dupes
> > merge_asof(trades, self.quotes, on="time", by="ticker")
> >
> > - def test_tolerance(self):
> > + @pytest.mark.parametrize(
> > + "tolerance",
> > + [
> > + Timedelta("1day"),
> > + pytest.param(
> > + datetime.timedelta(days=1),
> > + marks=pytest.mark.xfail(reason="not implemented", strict=True),
> >
> > No, not that I know of.
> >
> > —
> > You are receiving this because you modified the open/close state.
> > Reply to this email directly, view it on GitHub
> > <
> https://github.com/pandas-dev/pandas/pull/27650?email_source=notifications&email_token=AAKAOIU5BQ66CXKQS367NEDQF2H55A5CNFSM4IHWN4YKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCCME7GY#discussion_r316676824
> >,
> > or mute the thread
> > <
> https://github.com/notifications/unsubscribe-auth/AAKAOIR2IAWBEU2N2CDI5TTQF2H55ANCNFSM4IHWN4YA
> >
> > .
> >
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/27650?email_source=notifications&email_token=AICYMWLKCMZOYWV7C5F4QBTQF2MCFA5CNFSM4IHWN4YKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD45GEOI#issuecomment-523919929>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AICYMWOVBXYT7QB5BPLVE6DQF2MCFANCNFSM4IHWN4YA>
> .
>