Skip to content

DOC: Clarify behaviour of pd.merge #34495

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

Closed
wants to merge 1 commit into from
Closed

DOC: Clarify behaviour of pd.merge #34495

wants to merge 1 commit into from

Conversation

bharatr21
Copy link
Contributor

@phofl
Copy link
Member

phofl commented May 31, 2020

We should discuss first if this is the expected behavior. Imo that is pretty weird. The join is exactly the same for both cases, but the result is different. Does not seem consistent.

@jreback jreback added the Reshaping Concat, Merge/Join, Stack/Unstack, Explode label May 31, 2020
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.

yeah this actually looks like a bug

@bharatr21
Copy link
Contributor Author

bharatr21 commented Jun 7, 2020

@jreback @phofl what should the expected behaviour be? Also, some guidance through this part of the code would help (I believe this is responsible for the behaviour):

elif self.right_index and self.how == "left":
join_index, left_indexer, right_indexer = _left_join_on_index(
left_ax, right_ax, self.left_join_keys, sort=self.sort
)
elif self.left_index and self.how == "right":
join_index, right_indexer, left_indexer = _left_join_on_index(
right_ax, left_ax, self.right_join_keys, sort=self.sort
)

@WillAyd
Copy link
Member

WillAyd commented Jun 7, 2020

I think the index from left should be preserved in both cases no? So the second example is incorrect IMO

@WillAyd
Copy link
Member

WillAyd commented Jun 29, 2020

@Bharat123rox can you try to identify the code paths that cause this inconsistency?

@WillAyd
Copy link
Member

WillAyd commented Jul 8, 2020

Closing for now as I don't think this is something that we should document; probably needs some more discussion on the original issue and a fix to the code instead

@WillAyd WillAyd closed this Jul 8, 2020
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC:/USAGE: Resulting Index when merging over indices
4 participants