Skip to content

Datetime mergeasof tolerance #28241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 25, 2019
Merged

Datetime mergeasof tolerance #28241

merged 15 commits into from
Sep 25, 2019

Conversation

ianzur
Copy link
Contributor

@ianzur ianzur commented Aug 31, 2019

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

@mroeschke mroeschke added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type labels Sep 1, 2019
@alimcmaster1
Copy link
Member

@ianzur - this is great! Mind updating as per @jreback comments looks like this is almost there

@ianzur
Copy link
Contributor Author

ianzur commented Sep 23, 2019 via email

@alimcmaster1
Copy link
Member

Does this need a test? Can we now get rid of the xfail for test_tolerance in test_merge_asof?

@ianzur
Copy link
Contributor Author

ianzur commented Sep 25, 2019

@alimcmaster1 There is already a test in place. The test is not set to xfail.

@pytest.mark.parametrize(
"tolerance",
[Timedelta("1day"), datetime.timedelta(days=1)],
ids=["pd.Timedelta", "datetime.timedelta"],
)
def test_tolerance(self, tolerance):
trades = self.trades
quotes = self.quotes
result = merge_asof(trades, quotes, on="time", by="ticker", tolerance=tolerance)
expected = self.tolerance
assert_frame_equal(result, expected)

@alimcmaster1
Copy link
Member

@ianzur - LGTM now thanks! Yep see that now (wasn’t showing up earlier)

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm though @mroeschke or @jbrockmendel might have some thoughts

@WillAyd WillAyd added this to the 1.0 milestone Sep 25, 2019
@mroeschke mroeschke merged commit 83eb75b into pandas-dev:master Sep 25, 2019
@mroeschke
Copy link
Member

Thanks @ianzur.

proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
* whatsnew

* 🐛🔧

* BUG: convert datetime.timedelta to nanoseconds to fix (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* don't change this file

* CLN: sort imports

* BUG: (pandas-dev#28098) changes

* BUG (pandas-dev#28098) some more changes

* update whatsnew

* BUG: pass timedelta and datetime.timedelta to timedelta
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
* whatsnew

* 🐛🔧

* BUG: convert datetime.timedelta to nanoseconds to fix (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* don't change this file

* CLN: sort imports

* BUG: (pandas-dev#28098) changes

* BUG (pandas-dev#28098) some more changes

* update whatsnew

* BUG: pass timedelta and datetime.timedelta to timedelta
bongolegend pushed a commit to bongolegend/pandas that referenced this pull request Jan 1, 2020
* whatsnew

* 🐛🔧

* BUG: convert datetime.timedelta to nanoseconds to fix (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* BUG: mergeasof() now accepts datetime.timedelta as tolerance kwarg (pandas-dev#28098)

* don't change this file

* CLN: sort imports

* BUG: (pandas-dev#28098) changes

* BUG (pandas-dev#28098) some more changes

* update whatsnew

* BUG: pass timedelta and datetime.timedelta to timedelta
@ianzur ianzur deleted the datetime-mergeasof-tolerance branch June 27, 2021 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

merge_asof() tolerance cannot be datetime.timedelta
5 participants