I don’t understand meaning of left on and right on in pd.merge . Can anyone explain?
Screen Link:
My Code:
Replace this line with your code
What I expected to happen:
What actually happened:
Replace this line with the output/error
I don’t understand meaning of left on and right on in pd.merge . Can anyone explain?
Screen Link:
My Code:
Replace this line with your code
What I expected to happen:
What actually happened:
Replace this line with the output/error
As with all JOIN operations… when you have 2 ‘Groups’ to join…
you will have some items that appear in BOTH groups at the same time… those are the base of your join operation…
as you join the 2 groups… you keep the items that appear in both sides…
then you ask yourself… should I take the rest of the left group with me…> (Left Join)
or should I take the rest of the right group with me…> (Right Join)
or should i keep the common items only and discard all others… > (Inner Join)
And as said “an image is worth a thousand words”, this image describes it all:
For More info:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.merge.html
For a nice example: