-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: merge_asof should be treated as a left join #34484
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
Conversation
@phofl is this still active? If so can you address @mroeschke comments / questions? |
� Conflicts: � doc/source/whatsnew/v1.1.0.rst � pandas/tests/reshape/merge/test_merge_asof.py
@WillAyd Yeah, for sure. Missed that completely, sorry. |
@jreback I have a more general question about the
produces the left index.
although I would expect the right index here. Is this assumption correct? In this case I would modify the function calls of |
� Conflicts: � doc/source/whatsnew/v1.2.0.rst
@jreback Could you maybe have a look? |
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
@jreback seems like all comments were addressed, could you take a look? Thanks! |
� Conflicts: � doc/source/whatsnew/v1.2.0.rst
can you merge master and move the note to 1.3 and will look. |
� Conflicts: � doc/source/whatsnew/v1.2.0.rst
Done |
@phofl oldie, but if you can merge will take a look |
� Conflicts: � doc/source/whatsnew/v1.3.0.rst � pandas/tests/reshape/merge/test_merge_asof.py
@jreback merged, failure unrelated |
ok let me look closer at this. |
� Conflicts: � pandas/core/reshape/merge.py � pandas/tests/reshape/merge/test_merge_asof.py
how="right", | ||
) | ||
else: | ||
join_index = self.right.index.take(right_indexer) | ||
left_indexer = np.array([-1] * len(join_index)) | ||
elif self.left_index: | ||
if len(self.right) > 0: | ||
if self.how == "asof": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you write a comment here explaining why we're doing how="left"
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Generally this looks okay to me. Mind merging in master? |
merged master |
thanks @phofl very nice! |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
The fix broke one test (
test_merge_index_column_tz
intest_merge_asof.py
) which expected the right index instead of the left index.The default index selection does not work in case of asof and
left_index=True
. I had to catch this case here.